This is another noob question. I have written a code which has to classes that are created by me. This two classes are saved separetely. Obviously, i am just doing a tutorial, i didnt really come up with cocde on my won. So how do i compine these codes (the main code + two classes that are defined by me)
if i just write them all together, it gives me an error that the name of the file doesnt match the class name. (cuz i have 3 public classes in the same file i suppose..)
Combining classes
- bad_brain
- Site Owner
- Posts: 11639
- Joined: 06 Apr 2005, 16:00
- 19
- Location: In your eye floaters.
- Contact:
in simple words: you can´t...
there can only be one public class in a file, if there are more classes the other ones have to be private. the only possibility to put more multiple classes together is to create a package with the single classes:
http://java.sun.com/docs/books/tutorial ... epkgs.html


there can only be one public class in a file, if there are more classes the other ones have to be private. the only possibility to put more multiple classes together is to create a package with the single classes:
http://java.sun.com/docs/books/tutorial ... epkgs.html
