• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javap -c dotclassfilename

 
Niranjan Prasad
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15441
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's the decompiled byte code of your class.

Lookup the documentation of the javap tool.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic