CORE JAVA INTERVIEW QUESTIONS AND ANSWERS

CORE JAVA INTERVIEW QUESTIONS AND ANSWERS


Q.  What is Java?
It is a general-purpose computer programming language which is fast, secure, simple, architecturally neutral, reliable, portable and object-oriented. It is built by Sun Microsystem in 1995 which was initiated by James Gosling.

Q. Write any five features of Java.
            Object oriented 
            Platform Independence 
            Robust Secure  
           Automatic memory management

Q. Why java is platform independence?
It is because Java byte-code is not associated with any particular hardware platform. It can be executed on any machine with JVM.

Q. What is an Object?
The object is an instance of a class. It is the name of any person, place, things or entity. It must have and identity, state, and behavior.

Q. What is a class?
It is a blueprint of an object. A class may contain data (variables) and modules (method).

Q. What is OOP’s?
Object-oriented programming (OOP) is a new way of organizing around objects which represent as an instance of a class and it revolves around Abstraction, Encapsulation, Inheritance and Polymorphism.

Q. What is JDK?
It is a collection of various tools that helps in writing and implementing Java program.

Q. What is JVM?
Java Virtual Machine is piece software which interprets java bytecode for a particular
platform or we can say a JVM is a program that behaves like a computer.


Q. What is Bytecode?
When java compiler compiles the java source code, it becomes bytecode. So java bytecode is nothing but java compile code. It is a platform independent code.
Say Hello.java à compile à Hello.class (Byte Code) à Run in JVM

Q. What is UNICODE?
Unicode is a 2 bytes code international encoding set use to with characters and digit or symbol.



Q. Why Java is ‘Write once and Ran anywhere’?
When java source code compile it become bytecode and it run everywhere provided JVM is there. That is why it is called ‘Write once and Ran anywhere’.

Q. What is java Tokens?
Smallest individual units in a program are known as tokens.

Q. What are data types?
To identify the type of data involved in an operation is called Data Types. There are two types od data types (primitive or fundamental types) and (non-primitive or reference types)


Q. What are default values of different primitive types?
byte                 0
short                0
int                    0
long                 0 l
float                 0.0 f
double             0.0 d
boolean           false
char                 null

Q. What is the difference between primitive and nonprimitive (reference) data types in Java?
Primitive Data Type: Primitive means “very basic”. Very basic or Fundamental data types available with java is known Primitive data types. Example are byte, char, int, long, float, double etc.
NonPrimitve Data Type: Non-primitive data types or reference are those which uses primitive data type as a base like an array, enum, class etc.

Q. What is wrapper class?
It is a process by which we can convert primitive data type into object types.  Every primitive data type has wrapper class. All the wrapper class is the sub classes of the abstract number class.

No comments:

Post a Comment