Blog Archive

Theme images by Storman. Powered by Blogger.


Wednesday, July 20, 2016

Top 20 Java Interview Questions and Answers For Freshers.

Top 20 Java Interview Questions and Answers For Freshers. Latest Java Interview Questions With Answers. Freshers Java Interview Questions. Frequently Asked Java Interview Questions.


1.What is the most Important feature of java?

Java is platform independent language.

2.What do you mean by Platform Independence?

Platform Independence  you can run and compile program in one platform and can execute in any other platform.

3.What is JVM(Java Virtual Machine)?

JVM is Java Virtual Machine which is a run time Environment for the compiled java class.

4.What is JIT Compiler?

Just-In-Time(JIT) compiler is  used to improve the performance. JIT compiles parts of the byte code that have similar functionality at the same time,

5.Are JVM's Platform Independent?

JVM'S are not platform Independent. JVM'S are platform Specific.

6.What if main method declare as private?

No,It will compile fine but in run time it will error like main method should be in public.cannot find main method.

7.What is platform?

A platform is basically the hardware or software environment in which a program runs.
There are two types of platforms software and hardware.
Java provides software-based platform.

8.What all memory areas are allocated by JVM?

Heap, Stack, Program Counter Register and Native Method Stack

9.What is the base class of all classes?

java.lang.Object

10.What is javac ?

It produces the java byte code from *.java file.
It is the intermediate representation of your source code that contains instructions.

11.Can we mark constructors final?

No, Constructor cannot be declared final.

12.What are two different ways to call garbage collector?

System.gc() OR Runtime.getRuntime().gc().

13.Can we override a static method?

No, we cannot override a static method. Static means class level.

14.Use of finalize() method in java?

finalize() method is used to free the allocated resource.

15.Is it possible to overload main() method of a class?

Yes, we can overload main() method as well. 
But every time public static main(String[] args) will be called automatically by JVM.
Other methods need to call explicitly.

16. Does Java support operator overloading?

Operator overloading is not supported in Java.

17.Can I declare a data type inside loop in java?

Any Data type declaration should not be inside the loop. Its possible but not recommended.

18.List two java ID Es?

1.Eclipse, 2.Net beans and 3.IntelliJ

19.Can we inherit the constructors?

No, we cannot inherit constructors. 
We can call super class constructors from subclass constructor by using super() call.

20.Can this keyword be assigned null value?

No, this keyword cannot have null values assigned to it.

0 on: "Top 20 Java Interview Questions and Answers For Freshers."