Combining classes

Questions about programming languages and debugging
Post Reply
User avatar
isapiens
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 533
Joined: 05 May 2006, 16:00
17
Location: Turn around

Combining classes

Post by isapiens »

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..)

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

in simple words: you can´t... :wink:
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

:wink:

Post Reply