File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Difference between class and public class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between class and public class" Watch "Difference between class and public class" New topic

Difference between class and public class

Rajat Sarkar

Joined: Sep 07, 2008
Posts: 18
class Myclass

public class Myclass

Is there any difference between the above two classes?
When other classes uses 'Myclass', will they behave in the same manner?
Ronald Schild
Ranch Hand

Joined: Jun 09, 2008
Posts: 117
There is no difference in the class itself, but the access to the class is restricted differently.

Give the forum (or google) a search on public access and default access.

edit: While you're at it, search on protected and private access too
[ September 12, 2008: Message edited by: Ronald Schild ]

Java hobbyist.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 40052
Welcome to JavaRanch. A good place to start searching is in the Java Tutorials.
I agree. Here's the link:
subject: Difference between class and public class