210k views
3 votes
What is the Java source filename extension? What is the Java bytecode filename extension?

User Benyamin
by
7.4k points

1 Answer

7 votes

Answer:

The extension of java source filename is .java and the extension of bytecode filename is .class

Explanation:

The java program is saved with the classname along with .java extension. The .java extension indicated that the particular file in java file.

Suppose we have a program

public class Main1

{

public static void main(String[] args) {

System.out.println("Hello:");

}

}

This program is saved as :Main1.java

To compile this program in command prompt we use javac Main1.java.

On compiling the java program it will be converted into byte code which has extension .class filename extension. So on compile, this program will be converted into Main1.class

User Stoni
by
7.1k points