[5165] in java-interest
Re: stupid question
daemon@ATHENA.MIT.EDU (Richard Ching {Imonics})
Tue Jan 30 15:30:17 1996
Date: Tue, 30 Jan 1996 13:02:21 -0500
From: richard@aisgfl.gct.com (Richard Ching {Imonics})
To: sulam@construct.net
Cc: java-interest@java.sun.com
I think this is an excellent question!
I found that when a class that does not have a prefix "public" it can reside
in any source file, vice versa is not true. It is specially weird on
Win95 machine with the file convention.
For example: a file name helloworld.java with the following code.
import java.applet.Applet;
public class HelloWorld extends Applet
{
...
}
if you type javac helloworld.java, the compiler comes back and tell you
that HelloWorld class must defined in a source file call HelloWorld.java
However, if you type javac HelloWorld.java (Windows 95 is not case sensitive
on file name), it will work fine.
I do not see the significance of requiring the source file name the same as
the class name when the class declared as public. I have not yet look
into Java's language specification. May be James or Author can answer this
question.
Thanx
Richard Ching
Imonics
MCSE
> From daemon@java.sun.com Tue Jan 30 08:56:12 1996
> To: java-interest@java.sun.com
> Subject: stupid question
> Date: Mon, 29 Jan 1996 12:30:02 -0800
> From: James Waldrop <sulam@construct.net>
> Sender: owner-java-interest@java.sun.com
> X-Info: To unsubscribe, send 'unsubscribe' to java-interest-request@java.sun.com
> Content-Length: 981
>
>
> Ok, so I have a dumb question... ;)
>
> Let's say I am getting a warning like the following:
>
> Foo.java:108: Warning: Public class ImagePanel must be defined in a file called "ImagePanel.java".
> public class ImagePanel extends Panel {
> ^
> Foo.java:121: Warning: Public class RenderArea must be defined in a file called "RenderArea.java".
> public class RenderArea extends Canvas {
>
>
> I can stick these in a seperate file, sure, but I'm finding it difficult
> to do that and then import them. Also, I see a lot of other applets
> with multiple class definitions in one file, so I'm wondering what other
> people do to get around this warning.
>
> James
>
> --
> James Waldrop / Technical Director
> sulam@construct.net / Construct Internet Design
> sulam@well.com / http://www.construct.net
> -
> This message was sent to the java-interest mailing list
> Info: send 'help' to java-interest-request@java.sun.com
>
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com