Java Environment Setup

Java Environment Setup & Verify

1) Uses of Java
2) Java Syntax
3) Java Environment Setup & Verify
----------------------------------------
1) Uses of Java

Java is used to develop,
Desktop Applications (Ex: Acrobat Reader)
Web Applications (Ex: snapdeal.com)
Enterprise Applications (Ex: Banking Applications, Insurance Applications, ERP Apps etc...)
Mobile Applications
Embedded Systems 
Smart Cards
Games Applications
Scientific Applications etc...

Test Automation (with Selenium)
----------------------------------------
2) Java Syntax

i) Java is a Case Sensitive Language
Note: All Java keywords are pocket-sized letters (Ex: if, for, public, static, principal etc...)
ii) First Letter of Class Name should last inwards upper case
smrithi
Smrithi //Correct
seleniumtesting //Incorrect
Seleniumtesting //Correct
SeleniumTesting //Correct

iii) Method names should starting fourth dimension amongst lower case
iv) Java programme file get upward should just represent amongst flat name
v) Java programme execution starts from principal method, which is mandatory inwards every Java program.
vi) Every Statement / Step should destination amongst semi colon
vii) Code blocks (Conditional, Loop, Method ...) enclosed amongst {}
viii) Java supports Explicit Declaration of Data Types
In Java

int sno=123; //Correct
char x ='A';
boolean y = true;
--------------------
sro =102; //incorrect
---------------------
In VBScript

Dim city
city=100
---
---
city = "Hyderabad"
----
------
city = 12.34
Note: VBScript supports Implicit proclamation of Data Types only

ix) Java Supports Explicit Declaration of Variables

int a, b, c;
a=10;
d=20;//Incorrect

In VBScript
Dim a, b
a=10 //Correct
d=20 //Correct

Note: VBScript supports Implicit & Explicit proclamation of Variables
----------------------------------------
3) Java Environment Setup & Verify

In fellowship to write too execute Java programs too thence Java Environment is required,

Three of import Steps inwards Computer Programming,

i) Write a Program / Write a programme inwards whatever Editor
ii) Compile the Program
iii) Run the Program
-----------------------------
A) Steps for writing & executing Java programs using Command Line Interface

i) Download Java Software (JDK) too Install
ii) Set Environment variable (path variable) 
iii) Write Java programme inwards Notepad too salvage equally .java
iv) Compile the .java file inwards Windows ascendancy prompt too Run
----------------------------------------------------------
B) Steps for writing & executing Java programs using Eclipse IDE

i) Download Java Software (JDK) too Install
ii) Download Eclipse IDE too Extract
iii) Write Java Program inwards Eclipse Editor too Run
------------------------------------------------------------------------------
Download Java Software (JDK) from either java.com or oracle.com, too Install
Note: Download Java Software based on your Operating Environment

After Java Installation yous tin cash inwards one's chips Java folder inwards C:\Program Files
------------------------------------------------------------------
Set Environment Variable (path) 
Navigation:
First re-create jdk bin directory path,

Select "Computer" too right click
> Properties
> Advanced System Settings
> Environment Variables
> Select path variable from "System" Variables
> Edit
> Paste Java bin directory path inwards variable value field
> OK
> OK
> OK
> Close
---------------------------------------------------------------
Write too Execute a Java Program

Step 1: Write a Program

public flat Sample {
public static void principal (String [] args) {
System.out.println("hello Java World");
}
}
Save equally .java file amongst Class name
Sample.java
------------------------------------------
Step 2: Compile the Program

> Launch Command prompt
> Change to Java Program file directory
> Type javac File Name / Sample.java

Note: It creates Java Class File (.clsss file)
------------------------------------------------
Step 3: Run / Execute the Program

> Launch Command prompt
> Type coffee File get upward without extension
Ex: 
java Sample

Note: It displays the Output on the Console (Operating Environment).
--------------------------------------------------------------
B) Steps for writing & executing Java programs using Eclipse IDE

i) Download Java Software (JDK) too Install - Over
ii) Download Eclipse IDE too Extract
iii) Write Java Program inwards Eclipse Editor too Run
-----------------------------------------------------
Create Java Project
Create Java Package
Create Java Class
Write Java Code/program inwards the Java Class too Execute
---------------------------------------------------------------
Eclipse IDE:

> Eclipse IDE is a platform to write & execute Computer programs similar Java, Perl, Python, Ruby, PHP Etc...
> Eclipse IDE is Open Source Software
> It provides Editor for writing programs, Syntax Guidance, Context Help, too Auto Compilation etc...
----------------------------------------------------------------------------------------------
Navigation to write & execute coffee programs inwards Eclipse IDE,

> Launch Eclipse IDE
> Create Java Project
> Create Java Package
> Create Java Class

Write Java Program & Run
------------------------------------------------------------------
Configure Eclipse IDE 
--------------------------------------------------------------
Sample Java Program:

package abcd;

public flat Sample {
public static void main(String[] args) {
int a, b;
a=100;
b=100;

if (a > b) {
System.out.println("A is a Big Number");
}
else 
{
System.out.println("B is a Big Number");
}
}
}
--------------------------------------------------------------

Sumber http://www.gcreddy.com/
Post a Comment (0)
Previous Post Next Post