Learning Java - Tutorials.

JAVA is the most useful programming language now a days.
Most of the Companies seek students who already know JAVA or at least know its basics.

WHY??

Due to its following features:-
  • Platform Independent:-
It is not bound to any specific operation system. It is made possible by the use of Bytecode. In other languages a program is compiled into an executable code but in java, a program is first gets complied into Bytecode. This bytecode is then executed by JVM(java virtual machine). Hence to run java program, you should have only JVM installed in your system.
  • Distributed:-
It can be used to develop applications to communicate over the network. It is possible because java supports the TCP/IP protocol.
  • Enhanced Collection Framework:-
The collection framework provides a set of interfaces such as List, Map and classes such as ArrayList, LinkedList to store elements of different data types.
  • Dynamic Compilation:-
The process to compile a java source code at the time of running a java application is called dynamic compilation. It has interfaces that support runtime access to the java compiler to compile a dynamically generated java code. This is useful in creating java development tools.
  • Web Services:-
java introduces new APIs(application program interfaces) to support the development of Web-based applications that are used to exchange data with the clients. These APIs give every support needed to write Extensible Markup Language(XML) based Web applications.
  • Security:-
java introduces API called XML-Digital Signature to create and modify digital signatures. this way programmers can design security policies easily.


JAVA is an Object Oriented Programming language (OOP).
now I am not explaining OOP concepts here but if you any questions regarding them or the features discussed above ask here, I will try to answer them as quickly as possible.

I will post here and we will go deep in java programming step by step so just check out regularly.

Replies

  • Engg.Dee
    Engg.Dee
    hey dear plz keep posting here step by step....thanks for initiating .....
  • Engg.Dee
    Engg.Dee
    hey dear plz keep posting here step by step....thanks for initiating .....
  • clZazy
    clZazy
    no doubts?? that means either most of you are not interested or you guys understood it all 😛
    well for those who are interested here is the next topic:-

    Getting Started

    Java environment: It contains all of the following:

    (a.) JDK(java development kit):-

    It provides the following java tools:-

    -java :It serves as a java interpreter used to run java applications by reading and interpreting bytecode files.

    -javac :It is the java Compiler to convert java source code to bytecode files.

    -javap :It is a java disassembler to convert bytecode files to java source code.

    -jdb :It is the java debugger used to find errors in java programs.

    -appletviewer :It is used to run java applets.

    -jar :Serves as archives used to package related class libraries into a single executable java archive(JAR) file.

    (b.) JVM(java virtual machine):-

    It contains the java interpreter(java) which is used to convert bytecode files(which are not machine-specific) to machine-specific code.
    and hence only JVM differs for different machines or Operating systems.

    (c.) Java API(application program interface):-

    It is a collection of already created classes, interfaces and methods, provided in the form of java packages.

    Classification of java APIs in the form of java packages is as follows:-

    -java.lang :contains classes that are fundamental to the design of java programming language.

    -java.util : provides Collection framework, date and time capabilities and classes such as StringTokenizer.

    -java.io :classes for system input and output.

    -java.awt :classes to create user interface, graphics and images.

    -java.applet :classes that are used to create applets(we will learn about it later in this section) and communicate with them.

    -java.net :classes used to implement networking.

    (d.) Types of java programs:-

    -Applications : It is a program created by using java programming language. java applications are console, Character user interface(CUI) and GUI based standalone applications.
    now to execute a java application:-
    -first you compile the source code using javac compiler to translate it into bytecode.
    -and then run the bytecode using java interpreter.

    -Applets : It is a program written in java language that can be included in an HTML page in the same way as an image is included in a page. applet can be used in both the static and dynamic web pages to either display content or share information through the pages.


    Identifiers in Java: Identifiers are words that are not reserved and can be used while naming a variable or method.

    Rules for legel identifiers:-

    -must start with an underscore(_), letter or dollar sign($).
    -may consist of a letter, number underscore and dollar sign.
    -no spaces between identifier.
    -cannot be similar to any of the java reserved keywords.
    -they are case-sensitive, for example, MAN and man are different identifiers.
  • monujatt
    monujatt
    according to me, the person who have worked on java , he can easily move to the other languages...and its my personal experience too so far....😀
  • Engg.Dee
    Engg.Dee
    hey thanks man plz carry on.............!
  • clZazy
    clZazy
    these posts are going lengthy, so I will try to make them as short as I can.
    next topic:

    Fundamental Concepts

    Date Types:

    1. Integer :- used to store integer values. four types: byte(1 byte), short(2 bytes), int(4 bytes), long(8 bytes)
    2. Floating Point :- used to store fractional numbers. two types: float(4 bytes) and double(8 bytes)
    3. Character :- to store characters. char(2 bytes)
    4. Boolean :- to store logical values true and false only.

    Literals:
    A literal is a constant value that does not have a identifier. commonly used to initialize variables. they can be number, character, string or boolean value. for example: 23, 43.54, true, 'f' etc.
    types:

    1. Integer literals:- represent integer values. values can be in decimal(base 10), Octal(base 8) or hexadecimal(base 16) form. note: with octal and hexadecimal literals prefixes 0 and 0x are used respectively.

    2. Floating Point literals:- represent fractional values. note: by default all floating point literals have double data type. that's why error will occur if we assign a floating point literal to a variable of float data type because automatic type casting is not possible here(learn about it later). to avoid this error we have to put f or F at the end of literal to make it float. for example: float a=5.34f;

    3. Boolean Literals:- represent true or false only. note: they cannot be represented with 0 or 1 values like C and C++.

    4. Character literals:- represent single character or an escape sequence character. for example: 'A', '\n'(for new line) etc.

    5. String literals:- unlike C++, in java string is a class and not a primitive data type. hence all string literals are values of the String class objects.

    Type Casting or Type Conversion:
    process of converting a variable or value of one date type into another data type.
    types:

    1. Automatic type casting:- take place only if the two data types are compatible to each other and the range of the destination data type is longer than the range of the source data type. for example: int and float are compatible to each other.
    so an int value can be converted automatically to long value but long value can't be converted automatically to int value because long with 8 bytes is longer than int with 4 bytes.

    2. Explicit type casting:- for the above explained problem in automatic type casting we have to do explicit type casting.
    syntax: target_variable = (target_datatype) source_variable;

    Operators:
    operators allow programmer to perform certain operations on data and variables also called as operands.
    types:

    -Arithmetic: +, -, *, / and %

    -Assignment: = is simple assignment and +=, -=, *=, /=, %= are compound assignments. for example: i += 10 is same as i = i + 10

    -Relational: ==, !=, <, >, <= and >= are used to determine relationship between two operands and always return a boolean value.

    -Logical: &, |, ^, ||, &&, !, &=, |=, ^=, ==, != operate only on boolean operands.

    -Increment and Decrement: ++ and -- can be used as prefix and postfix of an operand. In prefix the value of the operand is incremented or decremented before assigning it to another variable and in postfix after.

    -Bitwise: &, |, ^, >>, << perform on individual bits and are applied to only integer types(byte, short, int and long).

    -special: instanceOf and dot operators. instanceOf check whether or not an object is of a particular type(class, interface or array) and dot(.) is used to invoke methods in a class.

    operator precedence:
    The operator with higher level of precedence is evaluated first when more than one operators are used in an expression.

    here is the list with decreasing operator precedence:

    • (), []
    • unary minus, ++, --, !
    • *, /, %
    • +, -
    • <<, >>
    • <, <=, >, >=, instanceOf
    • ==, !=
    • &
    • ^
    • |
    • &&
    • ||
    • =
    Arrays in Java:
    array is a collection of storage locations for same type of data.
    concept is same as C, C++.

    only difference is that, in java declaring an array does not mean memory is allocated.
    syntax: data_type var_name[];

    new operator is used to allocate memory to an array.
    syntax: var_name = new data_type [size];

    we can also combine declaration and creation.
    syntax: data_type var_name[] = new data_type[size];

    we can also declare, create and initialize array at the same time.
    syntax: data_type var_name[] = {array_element1, array_element2, array_elementn};

    also JVM automatically creates an array with size equal to the total number of elements added.

    enjoy learning🎉
  • clZazy
    clZazy
    been busy that's why delay.
    well today's topics are here

    Packages

    A package is like a folder in which you can store various classes related to each other.
    It also solves class name collision problem as we can have two classes with exactly same name inside two different packages.
    java API consists of many classes and interfaces that are arranged in the form of packages according to their similar functionality.
    types of packages:

    1. Built-in packages: these are available in java API. for example: java.lang, java.io, java.util, java.net, java.awt and java.applet

    2. User-defined packages: created by user and can also be used in the same way as built-in packages.
    now to create a package we use: package ;
    this must be the first statement in a java source file.

    Access Modifiers

    these are used to define the accessibility of members of a class, in the same class or other classes.

    1. public: it means the class member is accessible from anywhere.
    2. protected: class member is accessible from same class, subclass and non-subclass in the same package.
    3. private: class member is accessible only from the same class.
    4. default: if we do not use any of the above mentioned access modifiers. In this the class member is accessible from the same class, subclass in the same package and non-subclass in the same package.

    Classes

    class is a template to create java programs consisting of variables and methods.
    A java class must contain the main method as it is the starting point of the java program.
    note: applets don't need main methods.

    working of classes, objects, variables and methods is same as C, C++.
    only creating objects in java is different:
    -first we have to declare a variable of class type to store the object reference.
    -and then the new operator is used, that dynamically allocates memory to an object and returns a reference to it.

    Constructors

    constructors are methods having the same name as the class name that are used to initialize objects.
    note: constructor does not have any return type or void.
    types:

    1. Default Constructor: A constructor without any parameter. If no constructor is created explicitly then java first implicitly creates a constructor without any parameter and invokes it. the default constructor then initializes the variables to default values, zero for numeric data types, null for object reference and String type, and false for boolean.

    2. Parameterized Constructors: constructors having parameters. variables are initialized according to the values passed to parameters during the object creation.

    this keyword:

    All java objects include a data member named this, which is a reference to the current object. this keyword is useful if you need to refer to the current object. for example: when you want to pass the current object to a method.
  • Engg.Dee
    Engg.Dee
    thanks..........
  • clZazy
    clZazy
    Engg.Dee
    thanks..........
    I am happy to know that you are following these posts regularly 😀
  • Engg.Dee
    Engg.Dee
    i really needed that.........!

You are reading an archived discussion.

Related Posts

Hi friends, I want to do my final year project on this topic. But this system is already exist in US, Can anybody help me to improve the existing system....
when using Wombat1 how can i make a number to raise to a power of another number? That is, when it Runs it allows two inputs where one acts as...
Can anyone tell me what all modules are there in GRE Exam ?
hi, i want to make my first robot for to participate in robot wars. Actually, can anyone one tell from where i have to start................................. my work.
In IT, our client has acquired a company....what benefits can we get????????