How inheritance?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   jon_richardson
Posted On:   Friday, January 18, 2002 09:58 AM

I am an extreme newbie to java and jbuilder. (I downloaded jbuilder6 personal) Here are the steps I took, and my problem. Im making a very simple inheritance- two classes, one named "Person", and another class "Student" extending Person. I open jbuilder6, choose new project, set type to "jpx" as opposed to "jpr". (I don't know the difference between the two) I name the project "wp1". I choose "(default project)" as the template, then hit finish. Then I choose "new class", name the class "Person", hit "finish". I write out the declaration of Student in the same file as Person. I compile, and jbuilder informs me t   More>>

I am an extreme newbie to java and jbuilder. (I downloaded jbuilder6 personal) Here are the steps I took, and my problem.

Im making a very simple inheritance- two classes, one named "Person", and another class "Student" extending Person.

I open jbuilder6, choose new project, set type to "jpx" as opposed to "jpr". (I don't know the difference between the two) I name the project "wp1". I choose "(default project)" as the template, then hit finish.

Then I choose "new class", name the class "Person", hit "finish".

I write out the declaration of Student in the same file as Person.

I compile, and jbuilder informs me that since Student is a public class, it needs its own .java file named after it.

So I choose "new class" again, and then transfer Student class to it. I compile the Person class, OK. I compile the Student class and now it informs me that it cant find the Person class I'm trying to inherit from.

They both have "package wp1" stated at the top. Appearantly, thats not enough, so I go the the top of Student.java and do "import wp1.Person", and the autocomplete function even offers it as a suggested completion, so I imagine that it will now work.

But no, I compile, and now it complains about the very import that it suggested: "Student.java": Error #: 302 : cannot access class wp1.Person; java.io.IOException: class not found: class wp1.Person at line 2, column 12

Can anyone tell me what I'm doing wrong, and what I'm supposed to do?

   <<Less
About | Sitemap | Contact