• Post Reply Bookmark Topic Watch Topic
  • New Topic

class & file name  RSS feed

 
Jolie Lee
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
every class needs to store in a different file?

as i understand if i have class Time, then ihave to save my file name as Time.java.

so does that means i cannot have 2 class in one same file?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have as many classes in a file as you'd like, but only one of them can be marked "public".
 
Jolie Lee
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh, i see.

and i assumed that my file name would have to be the same as the public class.

Thanks.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jolie Lee:
oh, i see.

and i assumed that my file name would have to be the same as the public class.

Thanks.


That's correct!

Layne
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!