This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between class and public class" Watch "Difference between class and public class" New topic
Author

Difference between class and public class

Rajat Sarkar
Greenhorn

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
Sheriff

Joined: Oct 13, 2005
Posts: 38031
    
  22
Welcome to JavaRanch. A good place to start searching is in the Java Tutorials.
 
wood burning stoves
 
subject: Difference between class and public class
 
Similar Threads
threading single instance vs multiple instances
Is Sun Fooling US
Extend confused
Difference b/w class.forName
Generics Lower and Upper Bound