English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

4 answers

Ok, I have a couple here, I will start at Simple2 so the character '1' one does not get confused with an 'l' ell.

public class Simple2 {

}

This will compile, but will not run, as it has no 'main' method nor is an applet.

include java.applet;

public class Simple3 extends Applet {

}

This will compile, but will not run, unless in an applet. Once again will appear to do nothing, as it does nothing.

public class Simple4 {

public static void main(String[] args) {

}
}

This will compile and run, not as an applet, but will not seem to do anything, because it does not.

public class Simple6 {

public static void main(String[] args) {

System.out.println("Insert a written message here!");
}
}

This one will compile and run as a stand alone application and print the message to the screen.

This one had to be given in order for you to see the program working. The other programs are even simpler but cannot be given as examples. LOL.

[Edit]
Had to add 'void' to all main methods :P
There is no Simple5 it was an original typo for Simple6 to be Simple6 and not Simple5.

2006-07-21 09:35:03 · answer #1 · answered by Mark aka jack573 7 · 0 0

class test
{
public static void main(String arg[])
{
System.out.println("test");
}
}


save this as test.java, press ctrl +1 to compile and ctrl + 2 to run this java application.

2006-07-15 10:19:27 · answer #2 · answered by bekarthi 1 · 0 0

class myfirstjavaprog
{
public static void main(String args[])
{
System.out.println("Hello World!");
}
}




Compile it with:
javac myfirstjavaprog.java

and then run it with:
java myfirstjavaprog

2006-07-15 10:15:45 · answer #3 · answered by Mikael Svanstrom 2 · 0 0

http://www.programmersheaven.com/download/27849/download.aspx
enjoy

2006-07-15 10:15:08 · answer #4 · answered by Paultech 7 · 0 0

fedest.com, questions and answers