Re: compile javac help needed for beginner. apparently it doesnot understand the word extends?????

From: frabi (frabi007_at_gmx.de)
Date: 01/20/04


Date: Tue, 20 Jan 2004 15:45:50 +0100


George Kooper <tentimes5@hotmail.com > schrieb in im Newsbeitrag:
4ldq00d2n88dp6p795fbenh962fgsh331f@4ax.com...
> I have installed Java from Sun site to my Windows XP .
>
> I have modified the PATH statement to include:
> C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program
> Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program
> Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft
> VisualStudio\VC98\bin;C:\j2sdk1.4.2_03\bin;
>
>
> I have 2 files in my directory:
> Person.class:
> class Person {
> String name;
> int age;
> }
>
> and
> Customer.java:
> class Customer extends Person {
> // Inherits name and age
> // automatically from Person
> int custId;
> String phone;
> }
>
> I compile Person.java
> and get good compile:
> D:\javaschool\Labs\02_JavaDataTypes\Starter>javac Person.java
>
>
>
> but when I compile Customer.java; I get error.
> D:\javaschool\Labs\02_JavaDataTypes\Starter>javac Customer.java
> Customer.java:1: cannot resolve symbol
> symbol : class Person
> location: class Customer
> class Customer extends Person {
> ^
> 1 error
>
> apparently it doesnot understand the word extends?????
>
> Thanks

Hi!

I think you should make both classes Public, so they can be seen from
outside of the source files:

public class Persion {
   ....
}

and

public class Cusomer {
  ....
}

now the class Customer sould be able to access class Person.
Surprisingly i could compile both files with jdk1.3.1. what version do you
use?

best regards
  alex



Relevant Pages

  • compile javac help needed for beginner. apparently it doesnot understand the word extends?????
    ... class Customer extends Person { ... I compile Person.java ... Customer.java:1: cannot resolve symbol ...
    (comp.lang.java.programmer)
  • Re: question on multidimensional array
    ... > other compile errors in addition to that.. ... > voor het frame ... > public class Speelveld ...
    (comp.lang.java.help)
  • Re: [OT] Win32 JNI Console Class [was: Re: Clear the Screen]
    ... I know from some experience with Linux, the native code you are making into ... So when you are making your shared library you need to compile it with the ... If the library is compiled without being position independent then when you ... >> public class Console ...
    (comp.lang.java)
  • Re: Hiding base class methods
    ... "Tim Wilson" wrote: ... > compile since the method does exist. ... > public class Base: System.Object ... >> then the method of the derived class shows up. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Feature request for C# Generic inheritence
    ... I thought that for generic inheritance, the compiler will create an explicit type at compile time. ... Same way anonymous method works. ... public class GenericDecorator: T ... extender.Data (give the same ability as EventArgsbut more generic which can leverage other types that do not support generics. ...
    (microsoft.public.dotnet.languages.csharp)