Sunday, March 30, 2008

CORE JAVA FAQS

26.When the JVM terminates ?

The Java Virtual machine terminates when all the non-daemon threads of java application terminates.
If permitted by the security manager it can also call System.runtime.ext () for terminating the JVM.

27. Is it possible to know from the content of a class file whether it is a java class file or not?

The first four bytes of every java class file is a magic number “0xCAFEBABE”. So it is very easy to identify whether it is a java class file or not.


28.Name the process thru which JVM makes the types available to the running program?


The Java Virtual Machine makes types available to the running program through a process of loading, linking, and initialization.


29. Define loading, linking and initialization of java class ?

Loading : Loading is the process of bringing a binary form for a type into the Java Virtual Machine.

Linking :
Linking is the process of incorporating the binary type data into the runtime state of the virtual machine. Linking is divided into three sub-steps: verification, preparation, and resolution.

Initialization:
During initialization the class variables are their proper initial values.


30. What do you mean by first active use of a class in JVM?


· The invocation of a constructor on a new instance of the class.

· The creation of an array that has the class as its an element type.

· The invocation of a method declared by the class (not inherited from a super class) .

· The use or assignment of a field declared by the class (not inherited from a superclass or super interface), except for fields that are both static and final, and are initialized by a compile-time constant expression.

0 comments: