Say what?!?  I've written tons of Java applications that have more than one public class.

At 12:02 PM 1/13/2002 -0500, you wrote:
Rule No. 1 in Java: if you have more than one class in your application, you only can use "public" key word in the class which has main method (public static void main( ) ...).  Try the following code and name your file as Test2.java (not Test.java):

class Test implements Runnable {    // remove public key word here
public void run() {
for (int i=1; i<=10; i++){
System.out.println("Test:"+i);
}
}
}

public class Test2 {   // add public keyword here if you want to

public static void main (String args[]){

 Test te = new Test();
 Thread t = new Thread(te);
 t.start();

}
}


Compile Test2.java and run it:

C:\>java Test2


Cheer.

---------------------------------------------------------------------------------------------------------------------
Robert Burdick
Author, "Essential Windows CE Application Programming", John Wiley and Sons
Co-author, "Professional JSP, 2nd Edition", Wrox Press
Microsoft eMVP

[EMAIL PROTECTED]
www.wAppearances.com
(650)-917-8446 (office)
(650)-906-3707 (cell)
=========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com

Reply via email to