In java can i have more than one class/object in a file?
        Posted  
        
            by David
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by David
        
        
        
        Published on 2010-03-15T03:58:08Z
        Indexed on 
            2010/03/15
            3:59 UTC
        
        
        Read the original article
        Hit count: 260
        
So the way i've been told to do things is you have your file and the file name is Classname.java and then the code is something like this: 
class ClassName { 
SOME METHODS 
main {} 
}
and then thats all.
I'd like to have two objects defined and used within the same .java file. (i don't want to have to put the other class in a difernt file just because i'd like to send this to someone and i want to avoid hasstle of atatching multiple files to an email [the lazy do make good programers though if you think about it]) 
- is it possible to do this?
- do i have to do anything special and if so what?
- what are some mistakes i'm likely to make or that you have made in the past when doing this?
© Stack Overflow or respective owner