I'm trying to compile my java code, but it's not compiled.
I'm commanding javac File.java
File.class class file is not created yet, but my program is working perfectly. What kind of problem is thik
I'm trying to compile my java code, but it's not compiled.
I'm commanding javac File.java
File.class class file is not created yet, but my program is working perfectly. What kind of problem is thik
 
    
    TL;DR It is most likely that the File.java file contains a non-public top-level class of a different name, so the compiler created a .class file with the actual name of the class. Rename the class or the source file, so the names match.
More than 99.999% of the time, javac File.java will create a File.class file if compilation completes without error, but that is not always the case.
A .java file can contain many classes, and each class is compiled to a .class file named after the class. E.g.
File.java
class A { // top-level class
    class B { // nested class
    }
    void x() {
        class C { // local class
        }
        new Object() { // anonymous class
        };
    }
}
class D { // top-level class
}
This will create the following files:
A.class
A$B.class
A$1C.class
A$1.class
D.class
As you can see, no File.class was created.
When compiling from the file system, which is pretty much always the case, the following rules are applied by the compiler:
public..java file contains a public top-level class, the .java file must be named the same as that public class.General recommendations:
.java file.public, name the file after the class.The two recommendations help ensure that both the compiler and us mere humans can find the source file containing a class.
