You are on page 1of 2

Java programming: Java program code consists of instructions which will be execu ted on your computer system to perform

a task as an example say arrange given in tegers in ascending order. This page contains examples for beginners to understa nd how to use java programming for beginners to write simple Java programs. Thes e codes demonstrate how to get input from user, working with loops, strings and arrays. Programs are provided with output (image file) and you can also download class file and execute it directly without compiling the source file. Compiling and executing java programs Java programming software: To compile and run Java program code you need to down load JDK (Java Development Kit). To compile type: javac file_name.java where file_name is name of file containing java source code. Javac is the Java compiler which converts java code into bytecode. To run type: java main_method_class where main_method_class is the name of class which defines main method. Learn Java through books If you are just starting to learn Java then it is recommended to buy Java progra mming book. A Java book will help you to easy learn basic concepts and will act as a reference for all time. Java programming examples Example 1: Display message on computer screen. class First { public static void main(String[] arguments) { System.out.println("Let's do something using Java technology."); } } This is similar to hello world java program. Download java programming class fil e. Output of program: Example 2: Print integers class Integers { public static void main(String[] arguments) { int c; //declaring a variable /* Using for loop to repeat instruction execution */ for (c = 1; c <= 10; c++) { System.out.println(c); } } } Java programming: Java program code consists of instructions which will be execu ted on your computer system to perform a task as an example say arrange given in tegers in ascending order. This page contains examples for beginners to understa nd how to use java programming for beginners to write simple Java programs. Thes e codes demonstrate how to get input from user, working with loops, strings and arrays. Programs are provided with output (image file) and you can also download class file and execute it directly without compiling the source file.

Compiling and executing java programs Java programming software: To compile and run Java program code you need to down load JDK (Java Development Kit). To compile type: javac file_name.java where file_name is name of file containing java source code. Javac is the Java compiler which converts java code into bytecode. To run type: java main_method_class where main_method_class is the name of class which defines main method. Learn Java through books If you are just starting to learn Java then it is recommended to buy Java progra mming book. A Java book will help you to easy learn basic concepts and will act as a reference for all time. Java programming examples Example 1: Display message on computer screen. class First { public static void main(String[] arguments) { System.out.println("Let's do something using Java technology."); } } This is similar to hello world java program. Download java programming class fil e. Output of program: Example 2: Print integers class Integers { public static void main(String[] arguments) { int c; //declaring a variable /* Using for loop to repeat instruction execution */ for (c = 1; c <= 10; c++) { System.out.println(c); } } }

You might also like