How to Java Program

If you are beginner in java , want to learn and make career in the Java technology , this is best the page for you.

How to Java Program

If you are beginner in java , want to learn and make career in the Java technology , this is best the page for you.

How to Java Program

How to Java Program

     

If you are beginner in java , want to learn and make career in the Java technology , this is best the page  for you. Here we have explained how to learn Java and become a master of the Java technologies.

Java is a high-level Programming  language that requires a lot of effort and work to learn and master on  necessary Java technology to begin your real life projects.

 We here tried to give you a example, that helps you in understanding java technology more easier and simpler.

Basic On Java

As we Know Java is based on the concept of Object-oriented Programming language. It is a simple, secure, robust, multithreaded, portable, platform independent high level programming language. This feature of Java helps us in making a program that can run independently along in small machine. The Java Technology is completely based on Java Virtual Machine(JVM).The JVM act as Translator that convert the byte code into machine language which is a readable one.

Understanding Java Technology

Java is Platform independent language that you can run your compiled code on any operating without recompiling the source code. For a Beginners, want to start on java Program, then you need a notepad editor which is used to edit your java source code in it. Using a Java Compiler you can translate the source code into byte code. The Java Compiler is used to check the Syntax error in your code. Java has a number of compiler like JDK1.5,JDK 5.0 etc.If your code contains error then, Compiler show the error message on your command prompt. Otherwise, it convert the source code into byte code with extension .class file. We are already known with  Java virtual machine (JVM) on which java Technology based on. It acts as translator and interpreter between the language and the underlying software and hardware. The JVM act as  interpreter that  convert the byte code into suitable code for the respective operating system.

Java Program for Beginner

Our first application will be simple and easy. The Program  "the Good Morning India" Application is written in Java language. Write it into a Notepad Editor or copy it in your web browser, and save in  a file named as Good Morning India. java. This program  shows the  output function of  programming language by displaying the message "Good Morning India!". Java compilers check the filename and  match the class name.

Let Us Start With the Basic Programming Code

A java Program begins  with public class Good Morning India. Inside the Class, we declare Static void main function(String args[]) .To call a method that is object independent ,static method is called. we don't need to create the object of class or class is to be instantiate, The System.out.println is used to display the output on the Console System.

Source Code

In Text/Notepad editor, create a file name Good Morning India. java with the following contents:

class GoodMorningIndia

 {

  public static void main (String args[]) {

  System.out.println("Good Morning India!");   //Displays the output String on the Command Prompt//

  }
  
}

/** 
 Displays "Good Morning India!" to the standard output.
 **/ (Comment)

To Compile this Program we need Javac Compiler, Before working on any  core java applications, you need to download and install the Sun  JDK tools known as Java Development Kits.

 Before Compiling on a Command Prompt We need to set the Class Path in the Environmental Variable Property of My Computer or set in the Command Prompt. For the sake of Convenience, We set the Class Path  in Environmental Variable Property  such that we don't need to write repeatedly the same path  in command prompt for executing the application again and again.

 Set Class Path =C:\JDK1.5\bin;

Class Path variable is only the  way to tell applications, including the Java Development tools kits, where to look for user classes.

After Setting the Class Path ,We compile the Program code using

Javac Good Morning India. java 

Since Java is a Case sensitivity in  which words can be differ in meaning based on  use of different uppercase and lowercase letters.So,be make sure the Program code should be same typed in your Command Prompt  as you have saved your program in Notepad Editor.

If the Compilation is error free, The java return you on the Command Prompt and create a folder of Good Morning India. class file where you have saved the program in the respective directory. Once the Program is in this form, it is ready to run. Otherwise, Check the class file is created or not. In case it has been not created, the Compiler show the error message on Command Prompt and check the further error in your Syntax of programming code.

To Run this Program code

Java Good Morning

The Command Prompt display the Output

Good Morning India!