Skip to content
Sign upLog in
Difference between ".java" and ".class" files?
Profile icon

Hello. This is my first attempt of starting to learn programming in java. So, because isn’t quite similar to eclipse, I have a few questions; If I want to create a new class e.g. “Car”, I add a new file (which at first, I hope is the right way at all) and name it “”. In this file I create the class and there’s automatically coming up an additionally new file called “Car.class” with weird stuff in it. Is that correct or am I doing something wrong? Also, I can’t rename the main class or even change its access modifier. If I'm doing so, the whole program crashes. Those questions might be dumb, but maybe you can help me in spite of my bad English. Thanks in advance.

You are viewing a single comment. View All
Profile icon

.java files are the files with your source code. .class files are the compiled version and are executable by the machine. the compiler will compile your source code and then create a new file with a format that is understandable to the computer then tell the computer to execute that file.