# just starting java, stuck on superclasses



## bassmasta (Feb 28, 2010)

Well I"m learning java in first year CSE and I'm stuck on where exactly my superclasses are supposed to go.  The superclass is "Person"  and the class I'm working on is "Adult".  I've got the first line as "public class Adult extends Person"  but when I compile it says it can't find the superclass.  I've tried placing it in the same folder, the next folder up, and several other places.  My textbooks seem to think this should be obvious, and I"m a little stumped by the answers I get on google.  Thanks for any replies.


----------



## FordGT90Concept (Feb 28, 2010)

What is the line that declares the Person class?


----------



## bassmasta (Mar 1, 2010)

"public class Person extends Object"


----------



## FordGT90Concept (Mar 2, 2010)

extends Object is implied so you shouldn't need that if you don't want to.  In your example, Object would be the superclass and Person would be a subclass.  Your other class makes Person a superclass and Adult a subclass.

In the file, they should be like so:

```
public class Person
{
}

public class Adult extends Person
{
}
```
I don't like nesting classes because calling a class inside of a class gets tedious.


----------



## bassmasta (Mar 2, 2010)

but what would I save that as?  the Person class is already provided, so I can't insert it into the code anyway, but I'd like to know.

I've tried the problem on my home PC and it seems to work fine, so I'm thinking I'm just missing something obvious


----------



## FordGT90Concept (Mar 2, 2010)

You don't need the ability to modify Person if it is already designed to be extended.  All you should need is Adult extends Person.


----------

