+ 4
In JAVA does file name and class name must be same or it is recommended?
why so?
6 Respostas
+ 3
well then if I write two classes in a single java file what should I give the file name?
+ 2
@ashwaghosh you have to name .java to that class which will have main method. compiler will automatically make. class file for all classes that you have.
+ 2
Get file name then run method main()
Then example
I named one file with "Itaiyo.java"
Ah....what kind of that file?
Then compile....*wait 1 hour*
Run Itaiyo.class
This Itaiyo.class will run "new Itaiyo().main(*Some arguments which idk how to read*)"
#(I guessed all of that)
+ 2
didn't get it
+ 1
yes they must be same or it will cause error
0
dont know :)