.class and .java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

.class and .java

in java: What's de difference between these two foles: .class and .java? what file is compiled and what file is used for what? I am very confused :))

22nd Jun 2017, 7:56 PM
Hack TheREALITY
Hack TheREALITY - avatar
4 Answers
+ 1
.java files contain your source code and can be compiled .class files are the compiled code, but it isnt compiled into machine language, its compiled into java-byte code. when run it will be interpreted by the JVM
22nd Jun 2017, 8:08 PM
max
max - avatar
+ 3
.java file contains the code that we write. .class file is created by the JVM from the .java file. (.class file is also known as the bytecode)
22nd Jun 2017, 9:07 PM
Yasiru Nayanajith
Yasiru Nayanajith - avatar
0
and If i want to acces a file where should i put it? in the class folder or in the java file folder?
22nd Jun 2017, 8:55 PM
Hack TheREALITY
Hack TheREALITY - avatar
0
class if your program is going to access that 'file'
10th Aug 2017, 12:37 AM
max
max - avatar