i would use .java for running a program and ur saying we can use .class can we use both ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

i would use .java for running a program and ur saying we can use .class can we use both ?

i would use .java for running a program and ur saying we can use .class can we use both ?

5th Feb 2017, 1:05 PM
adithya krishna
adithya krishna - avatar
1 Answer
+ 1
The .java file is the file that you write with Notepad. When you issue the javac command, the Java compiler creates a .class file. The .class file contains the byte code representation of the .java file. Byte code is the code that the Java Virtual Machine runs. So, when you compile the program, you use the .java file. When you run the program, you use the .class file.
6th Feb 2017, 1:01 PM
Heng