wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes javap  -c  dotclassfilename Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "javap  -c  dotclassfilename" Watch "javap  -c  dotclassfilename" New topic
Author

javap -c dotclassfilename

Niranjan Prasad
Ranch Hand

Joined: Aug 13, 2005
Posts: 62
Hi
This is Niranjan

public class First
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}

I have this basic program as First.java
and compile javac First.java
and now I have used the following command
javap -c First
and i got the following in the command prompt.


Compiled from "First.java"
public class First extends java.lang.Object{
public First();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>" )V
4: return

public static void main(java.lang.String[]);
Code:
0: getstatic #2; //Field java/lang/System.out:Ljava/io/PrintStream;
3: ldc #3; //String Hello World!
5: invokevirtual #4; //Method java/io/PrintStream.println Ljava/lang/Str
ing V
8: return

}

What's all this.

Niranjan.In one of interviews panel has asked me.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14103
    
  16

It's the decompiled byte code of your class.

Lookup the documentation of the javap tool.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
jQuery in Action, 2nd edition
 
subject: javap -c dotclassfilename