javac - java file compilation with file extension -
when compile java program use javac file.java
command while running use java file
.
so why necessary explicitly specify file extension while compiling , not needed when run java program?
because when "run" java .class compiled file telling java application launcher class contains main method. launcher starts java runtime environment , loads specified class.
if write java myclass
, class main method myclass
. note erroneous write java myclass.class
, since myclass.class
not name of class.
when compile javac myclass.java
need tell java compiler extension, because file , need find it.
Comments
Post a Comment