This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes public class with default subclass? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "public class with default subclass?" Watch "public class with default subclass?" New topic

public class with default subclass?

Nicole Roesner

Joined: Dec 14, 2002
Posts: 2
Can a public class have a subclass with no modifier (default)?
Mellihoney Michael
Ranch Hand

Joined: Nov 27, 2002
Posts: 124
but it doesn't make sense, don't you think so???

a beginner in java
Bert Bates

Joined: Oct 14, 2002
Posts: 8898
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 ?

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
I agree. Here's the link:
subject: public class with default subclass?
It's not a secret anymore!