File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes compilation error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compilation error" Watch "compilation error" New topic
Author

compilation error

Georgie Shmolowitz
Greenhorn

Joined: Jul 23, 2012
Posts: 2

I have written a program Nhisto3.java which consists of two classes:

import java.applet.* ;
import java.awt.* ;
import java.util.* ;
import java.lang.*;
import java.lang.Math.* ;
import java.awt.event.*;
public class NHisto3 extends DBufferApplet implements ActionListener, Runnable {
………
class DrawingCanvas extends Canvas {
………..
}
}
The compilation fails:

javac Nhisto3.java
Nhisto3.java:11: class NHisto3 is public, should be declared in a file named NHisto3.java
public class NHisto3 extends DBufferApplet implements ActionListener, Runnable {
^
Note: Nhisto3.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

I am a tyro at Java and would appreciate some help.

BRS
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18564
    
    8

nosneb sunshine wrote:Nhisto3.java:11: class NHisto3 is public, should be declared in a file named NHisto3.java


I know this seems picky, but if you read the error message very carefully, you'll see that the filename you chose (Nhisto3.java) is not the same as the filename which the error message says should be used (NHisto3.java). Do you see the difference?
Tony Fu
Greenhorn

Joined: Sep 04, 2008
Posts: 10
I guess your filename is not the same with your class name "Nhisto3".Your java filename should be "Nhisto3.java".


Do everything by yourself!
Georgie Shmolowitz
Greenhorn

Joined: Jul 23, 2012
Posts: 2
Thanks for your help. Your observations were right on.

Oldtimer
 
Don't get me started about those stupid light bulbs.
 
subject: compilation error