Friday, May 13, 2016

Java Introduction

Introduction of Java

Java is a powerful tool for internet development projects. It is a simplified version of C++. According to Sun Microsystems, Java is a simple, object-oriented, statically typed, complied, architecture neutral, multi-threaded, garbage collected, robust, secure, and extensible.
Java can be used to create two types of programs:
-applets applications
-standalone applications

Below shown are some of the important things to keep in mind about Java program:
• Case Sensitivity - Java is case sensitive, which means identifier Hello and hello would have different meaning in Java.
• Class Names - For all class names, the first letter should be in Upper Case.   If several words are used to form a name of the class, each inner word's first letter should be in Upper Case.  Example class MyFirstJavaClass
 • Method Names - All method names should start with a Lower Case letter.   If several words are used to form the name of the method, then each inner word's first letter should be in Upper Case.  Example public void myMethodName()
• Program File Name - Name of the program file should exactly match the class name.   When saving the file, you should save it using the class name (Remember Java is case sensitive) and append '.java' to the end of the name (if the file name and the class name do not match your program will not compile).  Example : Assume 'MyFirstJavaProgram' is the class name, then the file should be saved as'MyFirstJavaProgram.java'
public static void main(String args[]) - Java program processing starts from the main() method, which is a mandatory part of every Java program.


OOP(Object Oriented Programming)

It enables us to think of program elements as objects. It is just a way to hide the details of program. The main concepts that are the backbones of OOP should  be understood to learn about OOP. They are
1.       Encapsulation
2.       Inheritance
3.       Polymorphism

Java Development Kit(JDK)

We needs to get a recent copy of the Java JDK in order to get started in Java programming. This can be obtained for free by downloading it from the Sun Microsystems website
In order to program for java, there are certain IDEs that helps us to work easily for programming. Some of the IDEs are as follows:
You can use any one of these IDEs.


First Java Program
public class Example1 {
public static void main(String args []) {
System.out.println("Hello this is my first java program");
}
}

Run the above program and the output will be :


OUTPUT:
Hello this is my first java program