This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hi  RSS feed

 
Sam Francis
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can a class exist with the private ror protected as the modifier?

the code is:

private/protected class one
{
void displayit()
{
System.out.println("Hai in main ; super");
}
}


I was just trying to find out the scope modifiers of the superaand sub classes.


and how do i attch the images if i'd want to?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Top level classes cannot be declared protected or private. Why not? Because those access modifiers don't have a useful meaning for top level classes.

You can find all the exact info in the Java Language Specification, paragraph 8.1.1.

p.s.: Next time please choose a more descriptive subject for your post than "Hi".
[ November 03, 2005: Message edited by: Jesper de Jong ]
 
Sam Francis
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!