![]() |
|
#1
|
|||
|
|||
javaHello guys I would be more than grateful if I got the answers to the following questions
1) What happens if you change the name of the source code file e.g ''helloearth.java instead of helloworld.java? 2) What happens if you keep the name of the source code file the same e.g "helloworld.java" but change the class name e.g class helloearth. |
|||
|
#2
|
|||
|
|||
Re: javaQuote:
If you change the name of the source code file to a different name then you must change the name of the outer most class to the same thing. Javac relates your filename to your class name in order to compile correctly. This is because everything is Object Oriented. It's not like C, where you can have any name you want for your file, because C doesn't implement classes and such. And by Object oriented, I mean super-OO, I mean the root class in java is Object, everything extends from this class. I don't know the exact reason why you have to have the source code file and class name the same, as in compiler structure and interpretations, but I do know that it just needs to be done. Justin Fox |
Recent GIDBlog
Going to Iraq by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C code to Java | bengt23648 | Java Forum | 2 | 09-Sep-2007 05:33 |
| What is the equivalent in Java for a Function or Module in VB | pengwinz | Java Forum | 2 | 17-May-2007 20:02 |
| To post messages / click Buttons of a Java Jar App using code | Jun0 | C Programming Language | 1 | 06-Jan-2007 14:44 |
| To post messages / click Buttons of a Java Jar App using code | Jun0 | Java Forum | 0 | 06-Jan-2007 11:14 |
| Scalability in Java and C++ | agx | Miscellaneous Programming Forum | 7 | 04-Feb-2006 15:35 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The