HELP! Java Programmer please answer this...

Stalker

Member
Oct 9, 1999
193
0
0
How do you inherit within java packages?
Even simple code like this doesn't work:

package test;
public abstract class a
{
}


package test;
public class b extends a
{
}


Explanation:
Above is to seperate class in a folder call test. I try to inherit class a to class b . "Main" will be a different file
 

Jumpem

Lifer
Sep 21, 2000
10,757
3
81
Ok, you have class "abstract", will that be your "main"? Are you trying to you use a class "test" in your main file(abstartct)? Explain it a little more and I can probably help you. I'll check this again in a few minutes.
 

Your code should work fine. Just be sure you put the source files in a directory called "test" (the name of the the package).
 

Stalker

Member
Oct 9, 1999
193
0
0
But the strange thing is I can't compile the second one
Here's gthe error message:

---------------- JDK Release Build ------------------
Compiling C:\WINDOWS\DESKTOP\test\a.java
C:\WINDOWS\DESKTOP\test\a.java:18: cannot resolve symbol
symbol : class m
location: class test.a
public class a extends b
^
1 error
Finished
 

Felicia

Member
Mar 12, 2000
58
0
0
Make sure you are compiling from the directory one level above "test".

C:\SOURCE> dir
test <dir>
a.java
b.java

c:\SOURCE> javac *.java