Introduction to Java



Introduction to Java
 

i) Introducing Java Programming Language

ii) Java Environment Setup

iii) Java Program Structure
---------------------------------------------
i) Introducing Java Programming Language
 

> Java Programming Language was developed at Sun Microsystems in 1991 (The first publicly available version of Java (Java 1.0) released in 1995, Now it is subsidiary of Oracle corporation.

> Java is an Object oriented Programming language, In Java every thing is object, java can be easily extended since it is based on Object model.

> Java is a Platform independent language, it can be compiled and Interpreted.

> Java is simple, easy to learn and implement.

> Java is Securable, using Java we can develop virus free and tamper free systems.
------------------------------------------
Usage of Java
 

> To develop Desktop Applications (ex: Acrobat Reader)

> To develop Web Applications

> To develop Enterprise Applications (Ex: Banking, Insurance Applications etc...)

> To develop Mobile Applications

> To develop Embedded Systems.

> Smart Cards

> Games software etc...
--------------------------
> Test Automation
--------------------------
Java Syntax Rules
 

> Java is a case sensitive language.

> First letter of Class name should be in Upper case.

> Method names should start with lower case letter.

> Java program file name should exactly match with class name.

> Java program execution starts from main method, which is mandatory in every Java program.

> Every statement/step should end with semi colon symbol.

> Code blocks enclosed with {}.
------------------------------------------
ii) Java Environment Setup
 

Steps:
 

1) Download Java Software (JDK) and Install.

2) Set Environment Variable path (Path variable)

3) Download Eclipse IDE and extract
------------------------------------------
Download Java (JDK) Software from either java.com or oracle.com, and Install.

After Java Installation then you can get Java folder in C:\Program Files.
-----------------------------
Set Environment Variable path (Path variable)
 

Navigation
 

First take jdk bin directory path

Select MyComputer and right click
> Properties
> Advanced System Settings
> Environment Variables
> Select Path variable from system variables
> Edit
> Paste java bin directory path in variable value field
> OK
> Ok
>OK
> Close
------------------------------------------
1) write and execute a Java program using command promt.

2) write and execute a Java program using Eclipse IDE.
-----------------------------------------------
1) write and execute a Java program using command prompt.
 

In Computer Programming we have three steps.

i) Write Program

ii) Compile the Program

iii) Run / Execute the program.
------------------------------------------
Step 1: Write a Program
 

public class Sample {
public static void main (String [] args) {
System.out.println ("Hello Java World");
}
}
-----------------------------------------------
Step 2: Compile the Program
 

> Launch Command prompt
> Chang to Java program file directory.
> Type javac Sample.java

* It creates Java class file
------------------------------------------
Step 3: Run / Execute the program.
 

Type java Sample

Then it display the Output on the Console.
--------------------------------------------
2) write and execute a Java program using Eclipse IDE.
 

Eclipse IDE (Integrated Development Environment)

> Eclipse IDE is a platform to write and execute computer programs like Java, Perl, Python, Ruby, PHP etc...

> Eclipse IDE is open source.

> It provides Editor for writing programs, Syntax guidence, Context help, auto compilation etc...
--------------------------------------------------------------------------
Steps to Write and Execute a Java Program using Eclipse IDE :
 

> Launch Eclipse IDE

> Create Java Project

> Create Java Package

> Create Java Class

Write Java Program and Run.

Note: Eclipse IDE provides auto compilation facility.
-----------------------------------------
A Sample Java Program
 

package abcd;
public class Smitha {
public static void main(String[] args) {
int a = 100;
System.out.println("Hello Java");
System.out.println(a);
}
}
------------------------------------------

0 comments:

Post a Comment