Hello, i'm beginning with java and i'm confused about running/compiling program.
I have A.java file with following code:
I read that i can use feature single-file-source-code, so i don't have to write "javac A.java" and then "java A" for running my simple programs. But when i run it with "java A.java" i get no error. If i compile it with javac, then i get error (A.java:1: error: class B is public, should be declared in a file named B.java) as i would expect.
Can anyone explain to me, why is it working differently? Thanks