JAVA Interview Question for Core Java

Q1. Describe public static void main Function(String args[]) in Java.
Ans: main() :This is the starting point for the interpreter to begin the execution of the program.

public: Public is an access specifier that declares the main method as unprotected and therefore making it accessible to all other class.
static: which declares the method as one that belongs to the entire class and not a part of any object of the class .The main always be declared as static since the interpreter use this method before any objects are created.
void: The type of modifier void states that the main method does not return any value (but simply print the screen).

Q2. Types of inheritanc in JAVA ?

Ans:  Types of inheritance in java are:

  • Single
  • Multiple
  • Multilevel
  • Hybird
  • Hierarchical

Q 3. What is JAVA ?

Ans:  java is  a Platform  Independent  High level Programming    language .

Q 4. What are the Java IDE’s?

Ans: NetBeans and Eclipse are the IDE’s of JAVA.

Q 5. What is Constructor?

Ans:  A constructor resembles an instance method in java but it’s not a method as it. A  constructor  name same as  Class name When Object  is created  constructor  is  automatically Called.

Q 8. What is an Object?

Ans : An Object is instance  of  class. The object has state and behavior.

Syntax:

ClassName ReferenceVariable = new ClassName();

Q 9.What is a Class?

Ans: A  Class  is  a  Collection  of  Object.

public class Add{ //Class name declaration
int x = 5; //Variable declaration
int y= 5;
public void add(){ //Method declaration
int z = a+b;
}
}

Q 10. List of OOps  Concept  in JAVA ?

Ans :List  of  OOPs in  JAVA

  • Inheritance
  • Encapsulation
  • Polymorphism
  • Abstraction
  • Interface

Q 11: How does Java enable high performance?

Ans: Java uses Just In Time compiler to enable high performance. JIT is used to convert the instructions into bytecodes.

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *