Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

public class with default subclass?

 
Nicole Roesner
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a public class have a subclass with no modifier (default)?
Thanks!!
 
Mellihoney Michael
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes
but it doesn't make sense, don't you think so???
 
Bert Bates
author
Sheriff
Posts: 8900
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nicole -
Is your question:
public class Test { }
class Sub extends Test {}
??

This is legal and fine, what are you wondering about? What problem do you see ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic