What are the Java tokens?

Java tokens mean the smallest individual units in a program. It includes five types of tokens:
1. Keywords.
2. Identifiers
3. Literals
4. Operators
5. Separators
1. Keywords: The words which are reserved in a language for specific purposes are known as Keywords. These keywords are written in lower-case (small letters). Their meaning and their functions are already known to the compiler. Java has 50 keywords. Since different keywords are used for different purposes they cannot be used as an identifier for variables, classes, methods etc.

2. Identifiers: Identifiers are the names given to the variables, classes, methods, objects, labels and interfaces in program Java identifiers follow the following rules:
1. It should not be a keyword which is available in the language.
2. First character of identifier should be an alphabet or underscore.
3. No other special character is allowed except underscore (_).
4. Both the cases that are upper case and lower case are allowed. An identifier student is not same as STUDENT.

3. Literals (Constants): Literals are used to store constant values (that cannot be changed) in variables. They are a group of characters which can be letters, digits etc. There are five types of literals in Java. They are:
1. Integer literals
2. Floating point literals
3. Character literals
4. String literals
5. Boolean literals.

4. Operators: Operator specifies which operation to be performed on the variables in an expression. Different operators perform different kinds of operations.
1. Arithmetic operators
2. Relational operators
3. Logical operators
4. Assignment operators
5. Increment and decrement operators
6. Conditional operators
7. Bitwise operators
Special operators like instance of and dot operator (.)

5. Separators: Separators are basically used to define the structure of the source code.
E.g. parentheses () – used for sending and receiving arguments in a function.
braces { } – used for assigning values to array at the time of its declaration and also used for block of statements.
Brackets [ ] – used for declaring array and accessing its elements
Semi color; – used at the end of every line

What are the native methods in Java?

Native methods are the methods whose source code is written in any other languages like C, C++ etc. Native methods are used when that it very difficult to rewrite the already existing code of other programming languages like C, C++ etc in Java. In order to declare a native method native keyword is used like public native method_abc(). This native keyword is used for informing the java compiler that this method has been written in a language other than java.

What is Thread Synchronization?

Thread synchronization is the process in which only one thread can use a particular method or object and no other thread can access the same method or object at the same time. Thread gets a lock on the object and until the thread releases the lock from that object no other thread can use the same object.

“Synchronized” keyword is used in Java to implement thread synchronization.
Synchronized keyword can be used in two ways:
1. Synchronized keyword can be used with the methods. When a method is declared synchronized then the thread gets a lock on that method and unless that thread releases the lock no other thread can use that method.
For e.g.: synchronized void deposit()
{

}

2. Synchronized keyword can also be used with a block of statements. We can apply synchronized to a set of statements rather than the whole methods.
Eg: synchronized (object)
{

}

What are the different keywords in JAVA?

The meaning and the functions of keywords are already known to the compiler of the language. These are the reserved words. Different keywords are used for different purposes.
E.g.: Boolean, byte, try, catch, class, extends, final, finally, implements, import, instance of, int, interface, new, package, private, protected, public, super, synchronized, throw, throws etc.

What are the features (characteristics) of Java?

Features of Java:

1. Platform independent: An important feature of Java is Platform independent. A program written in java can be executed on different platforms without any changes. Because of this portability feature Java is a popular language for internet.

2. Compiled and interpreted language: Java is a both a compiled and interpreted language. The program written in Java is first translated by java compiler into Byte code. After that the java interpreter converts the byte code into machine code which can be executed on machine.

3. Object oriented programming: Java is an object oriented language. Java supports all object oriented programming features like abstraction, encapsulation, data hiding, message passing etc.

4. Robust and secure. Java provides automatic garbage collection which automatically removes unused objects. It also supports exception handling which handles errors (exceptions) at the run time. Java provides security by ensuring that applets cannot access the local system.

5. Simple and easy to learn: Java is a simple and easy to learn as it is quite similar to C and C++ languages. Java does not support those features of C or C++ which affects the security of code. For e.g., Java does not use goto statement, pointers, operator overloading and multiple inheritance.

6. Automatic memory management: Java provides automatic garbage collection which automatically deletes an unused object and deallocates memory allocated to that object.

7. Multithreaded: Java supports Multithreading. Multithreading is a technique by which the programmer can execute multiple sub processes concurrently (at the same time). In others words, Multithreading means executing multiple parts of a program.

What is JAVA?

Java programming language was invented by a team under the guidance of “James Gosling” at Sun Microsystems in 1995. Java is a Platform independent language. Java is used for internet applications, mobile applications and consumer devices. Java is platform independent language because of its byte code which can be executed by JVM (Java Virtual Machine). Java is both a compiled and interpreted language because program written in JAVA is first converted into Byte Code (Intermediate Code) by Java compiler which is then executed by Java Interpreter.

Who invented Java?

Java programming language was invented by a team under the guidance of “James Gosling” at Sun Microsystems in 1995. Java is a Platform independent language. Java is used for internet applications, mobile applications and different consumer devices.