Java Interview Questions Bank By CodeAtNow

 Java Interview Questions Bank.

What is Java ?
  • Java is a general purpose , object oriented programming and most widely used language which was developed by James Gosling in 1990's. 
  • It is system independent language where one can run the compiled byte code in any other system which contains JRE in it. 

What is the features of Java ?
  • Platform Independent : The byte code generated on one computer can run on another system.
  • Robust : Can easily handle the errors during execution.
  • Multithreaded : It enables users to write programs that can perform many task at a time. Variables are the storage location which are used to store different types of data in java are three types of variables based on their scope,
  • Local Variables : These are the variables that are declared inside a method.
  • Static Variables : These are the variables when one want to initialize them when the execution of program starts , they are defined using static keyword.
  • Instance Variables : These are defined outside method but inside class.

Difference between JDK , JRE , JVM ?

  • JDK (JAVA DEVELOPMENT KIT) : It is a Software Development Environment which is used for developing java programs. 
  • JRE (JAVA RUNTIME ENVIROMENT) : is a space which enables users to execute java programs.
  • JVM (JAVA VIRTUAL MACHINE) : JVM (Java Virtual Machine) is responsible for providing the runtime environment in which java compiler generated byte code can be executed.

What Is Meant By JIT Compiler? Define Its Usage ?

  • JIT (JUST IN TIME) Compiler is responsible for compiling code at runtime instead of compiling it during the compile time of the programs (also known as Ahead-Of-Time). It improves the performance of java programs by compiling the generated byte code into machine code at run time.

What Are Various Access Specifiers In Java? 

In general access specifiers when we want to restrict the usage of variables under scope. Mainly There are three access specifiers in java. They are
  • Public – These members can be accessible everywhere in the program.
  • Private – These members are accessible only inside the class.
  • Protected – These members can be accessible outside package only with the help of child class.

Why The Main Method In Java Is Declared As Static? 

In java the static method is the one which is going to created inside the memory even before initializing the instance(object) of it. So, as we all know that in java the execution starts from the main method, we need to make sure that the main methods is called first with the help of declaring it as static method.


Final Keyword And It’s Usage In Java?

Final keyword in java is used when we want to make sure that the state/value of the variable or object Shouldn’t be changes once it’s initialized. So, when final keyword is used in declaration of class then no inheritance is possible, if we declare a method using final keyword then that method cannot be overridden and finally the final variable cannot be changed once it was initialized.

 

      Post a Comment

      0Comments
      Post a Comment (0)