Search This Blog

Friday 20 March 2015

core java interview questions

For develop the android we need the knowledge of core java . core java is the basic concept of the android.so, lets go throw out from core java questions .

1) What if main method declare as private.?

prog compiles properly but runtime send the message that main method ids not public

2) is it possible that multiple main methods in  same class?

no prog fails to compile and sows the message that main method already define in main class.

3) is it possible that multiple classes use in the same methods ?

yes it is possible.

4) do i need to import java.lang package any time ?

no it isn't need because it is by default loaded by internally JVM .
  
5) explain the overriding.

the overriding is the class use the same name, return type  and arguments as method it's superclass it called the overriding . method in the class override method in the superclass.

6) which variable do i need to set for run the java prog properly 

CLASSPATH and PATH this two variable are need to set.

7) how we can defind that string is null or not in one line argument ?

print args.length is display the length of the string.

8) what is the platform ?

a platform is basically the hardware and software  environment which prog  runs. there are two types of platforms.

9) what is the main difference between the java plate from and other platform ?

the java differs from the other platforms in the sense it's software base platforms that runs on the top of hardware plate from . it has two components  

1) runtime environment

2) application programming  interface   (API)

10) What is the classloader ?

classloder is the subsystem of jvm used to load class and interface. there is many classloader like system classloader,plugin classloder , extension classloder.

11) how many memory allocate provide by jvm ?

class area ,heap,stack,prog counter register, native method stack.

12) what is JVM ,JRE and JDK ?

JVM - java virtual machine it is platform dependent . it is available fro many software and hardware

JRE - java runtime environment. it is the implementation of jvm and phy exist.

JDK- java development kit  . It contains JRE + development tools.

13) what is the default value of local variable ?

The local variables are not initialized to any default value, neither primitives nor object references.

14) what gives java its 'write once and run anytime' nature ?

The bytecode. Java is compiled to be a byte code which is the intermediate language between source code and machine code. This byte code is not platform specific and hence can be fed to any platform.

15) What is JIT complier?

Just-In-Time(JIT) compiler:It is used to improve the performance. JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation.Here the term “compiler” refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.








No comments:

Post a Comment