Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between class and public class

 
Rajat Sarkar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Campbell Ritchie
Sheriff
Pie
Posts: 50251
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch. A good place to start searching is in the Java Tutorials.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic