To see what
is available in a.class file we can take the
help of java profiler command.
When we use the java profile command we have observe the
following code in Add.class
Ex:
Public class Add extends
java.lang.object
{
{
public Add();
public static void
main(java.lang.String[]) //save
Add.class
If we want to see all the instructions also we have to use an
option “_c”
Ex:
Javap
–c Add
We can invoke the JVM by using the
command java. When we invoke the JVM it searches for appropriate class file. It
the class file is available it loads the class into JVM’s memory.
- If the class is not available JVM throws and Exception java.lang.Noclass Def FoundError: sub.
- After the class is loaded JVM checks for main method. If it is available JVM starts the execution from main method.
- If the main method is not available JVM throws an Exception NO such method Found Error: main
0 comments:
Post a Comment