[2125] in java-interest

home help back first fref pref prev next nref lref last post

Re: class in differents files

daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Mon Sep 25 21:55:26 1995

Date: Mon, 25 Sep 1995 16:43:03 -0800 (PDT)
From: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
Reply-To: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
To: prepapol@lifl.fr
Cc: java-interest@java.Eng.Sun.COM



Hi Bruno,

> I would like writing a package with several files (.java). And some of them
> contains some objects of a class which is writting in an other file and this
> file contains some objects which have their class type in the first file.
> 
> For exemple :
> 
> ------------------
> //classA.java
> 
> package MyPackage;
> 
> class ClassA
> {
>   ClassB cb;
>   ...
> }
> 
> ------------------
> //classB.java
> 
> package MyPackage;
> 
> class ClassB
> {
>   ClassA ca;
>   ...
> }
> 
> In this way if I compile classA.java, it don't know classB and vis and versa.
>  If someone have any idea to do this ? (classA.java and classB.java are
> compiling in the same directory).
> 
> -------------------------------------------------

You need to put your classes in a subdirectory called "MyPackage". For example:

	mkdir MyPackage
	mv classB.java classA.java MyPackage
	javac MyPackage/*.java

Have fun,

	Arthur van Hoff

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post