Java Online Training: Java Tutorial For Beginners - Part 1
Java Online Training: Java Tutorial For Beginners - Part 1
These tutorials will introduce you to Java programming Language. You'll compile and run your own Java application, using
Sun's JDK. It's extremely easy to learn java programming skills, and in these parts, you'll learn how to write, compile, and
run Java applications. Before you can develop corejava applications, you'll need to download the Java Development Kit
(JDK).
History of Java
SCJP Notes 1
SCJP Notes 2
SCJP Notes 3
SCJP Notes 4
PART-1
SCJP Notes 5
SCJP Notes 6
SCJP Notes 7
SCJP Notes 8
Java Test
Our first application will be extremely simple - the obligatory "Hello World". The following is the Hello World Application as
written in Java. Type it into a text file or copy it out of your web browser, and save it as a file named HelloWorld.java. This
program demonstrates the text output function of the Java programming language by displaying the message "Hello
world!". Java compilers expect the filename to match the class name.
Study in Germany
Find Top Colleges in Germany. Get Info on Admission,Visa,Scholarships
SQL Tutorial
PLSQL Tutorial
PLSQL Examples
HTML Tutorial
What is XML?
XML Tutorial
public static void main(String[] args) {
statements
}
XML Interview
}
HTML Interview
Partner websites
Source Code
Bird Watching
Haryana Online
Asia Newscast
North India Online
In your favorite editor, create a file called HelloWorld.java with the following contents:
/** Comment
* Displays "Hello World!" to the standard output.
*/
class HelloWorld {
public static void main (String args[]) {
System.out.println("Hello World!");
}
}
To compile Java code, we need to use the 'javac' tool. From a command line, the command to compile this program is:
javac HelloWorld.java
For this to work, the javac must be in your shell's path or you must explicitly specify the path to the program (such as
c:\j2se\bin\javac HelloWork.java). If the compilation is successful, javac will quietly end and return you to a command
prompt. If you look in the directory, there will now be a HelloWorld.class file. This file is the compiled version of your
program. Once your program is in this form, its ready to run. Check to see that a class file has been created. If not, or you
receive an error message, check for typographical errors in your source code.
You're ready to run your first Java application. To run the program, you just run it with the java command:
java HelloWorld
Sample Run
Hello world!
The source file above should be saved as myfirstjavaprog.java, using any standard text editor capable of saving as ASCII
(eg - Notepad, Vi). As an alternative, you can download the source for this tutorial.
HelloWorld.java
Note: It is important to note that you use the full name with extension when compiling (javac
HelloWorld.java) but only the class name when running (java HelloWorld).
Previous
Copyright 2006-2013 Free Java Guide & Tutorials. All Rights Reserved.
Next