Learning Java/Introduction to Java: Difference between revisions

Content deleted Content added
Remi (discuss | contribs)
el - Introduction to Java - December 2006
Line 65:
 
The Java compiler reads basic text files. Open up a text editor like Notepad (do not use a complex program like Microsoft Word for this). Type this code, remembering that Java is case-sensitive:
<presource lang="java">public class HelloWorld
{
public static void main (String[] args)
{
System.out.println("Hello World!");
}
}</presource>
Here's the JDK 1.5 or later version of Hello World
<source lang="java">
<pre>
public class HelloWorld
{
public static void main(String... args)
{
System.out.println("Hello World!");
}
}
</presource>
 
Save this file as HelloWorld.java. Start your system's command line and navigate to the folder that you saved HelloWorld.java to. Type <code>javac HelloWorld.java</code>. This runs the java compiler, javac, and creates a class file, which contains the bytecode for the application. Next type <code>java HelloWorld</code>. This runs the class file that was just created by the compiler. Your console should print: