Why do two java files that differ only in comments produce different class files?
•
Java
I have one named one Java file, which has only one comment line I compile it to generate the class file one Class and rename it old class. Then I opened one Java, introduces five additional comment lines and compiles it again to generate one class. Both class files have the same size, but when I run diff on them, such as:
Binary files One.class and old.class differ
This is my one Java file:
// One.java class One { public static void main(String [] args) { System.out.println("Hello Java world"); } }
This is the one I modified Java (attach comment line):
// One.java // One.java // One.java // One.java // One.java // One.java class One { public static void main(String [] args) { System.out.println("Hello Java world"); } }
I use Java se 10 on IMAC running high Sierra
resolvent
Solution
Commissioning symbols; Basically, the code includes line numbers and other metadata for debugging You can use javap - V one Class and javap - V old Class check it @ h_ 502_ 4@ @H_ 502_ 4@
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码