elibraryportal Logo

Core Java Interview Question .


1) What do you mean by Java?

→ Java is an object-oriented computer programming language.

→ It is a high-level programming language developed by James Gosling in Sun Microsystem in 1995


2) Difference between JDK,JRE and JVM ?

JVM :

  • It Stand for Java Virtual Machine, it provides a run time environment in which java byte code can be executed.
  • JVM is platform dependent
  • Java Virtual Machine, are available for many hardware and software platforms.

JRE :

  • It stand for Java Runtime Environment. It is the implementation of JVM.
  • Java Runtime Environment and may also be written as "Java RTE."
  • JRE provides the minimum requirements for executing a Java application; it consists of the Java Virtual Machine (JVM), core classes, and supporting files.

JDK:

  • It stand for Java Development Kit
  • It provides a environment to develop and execute(run) the Java program.It contains JRE + development tools.
  • JDK is only used by Java Developers.

3) Explain that public static void main(String args[]).

public : Public is an access modifier,. Public means declared from anywhere. such as method and class.

static : It is a keyword.that is declare variable class, method.

void : It is the return type of the method. Void does not return any value..

main: main is startup of the program.

String args[] : It is the parameter passed to the main method. And command line argument.


4) Why Java is platform independent?

→ Platform independent means "write once run anywhere". Java byte codes run on any operating system.

5) .java file name a valid source file name?

→ Yes, you can save .java only,

//compile by javac .java

//run by java A

compile it by javac .java and run by java yourclassname

6) What is Object?

→ Object is real word entity that means every things is object .An object consists of methods and class.

7) What is class in Java?

→ A class is the blueprint from which individual objects are created.

8) Is delete,next,main,exit or null are keyword in java ?

→ No

9) If I don't provide any arguments on the command line, then the String array of Main method will be empty or null?

→ It is empty. But not null.


10) Explain public static void main(String args[]).

  • public : Public is an access modifier, which is used to in any class inside any package.
  • static : It is a keyword in java ,If we declare any method as static, it is known as the static method. The core advantage of the static method is that there is no need to create an object to invoke the static method. The main method is executed by the JVM, so it doesn't require to create an object to invoke the main method. So it saves memory.
  • void :It is the return type of the method. Void defines the method which will not return any value.
  • main : main represents the start up of the the program.
  • String args[] : It is the parameter passed to the main method.
  • 11) Why Java is platform independent?

    Platform independent means "write once run anywhere" because byte codes can run on any operating system such as window 7, linux, etc.

    12) What are wrapper classes?

    Wrapper classes converts the java primitives into the objects types . Every primitive data type has a class dedicated to it. These are known as wrapper classes

    Primitive TypeWrapper class
    booleanBoolean
    charCharacter
    byteByte
    shortShort
    intInteger
    longLong
    floatFloat
    doubleDouble
    Next Topic