Set Path of Java JDK Steps by Steps

Java set path of JDK in windows

There are Two ways to set path-

  1. Temporary
  2. Permanent
1- Steps to Set JDK path Temporary

1- Copy the path of bin folder.

Example:
First

2- Write in Command Prompt :
set path="C:\Program Files (x86)\Java\jdk1.6.0_18\bin" and press Enter key.

Example:
Second

2- Steps to Set JDK path Permanent
Set path of JDK

1- Ringht click of MyComputer and go to Properties.

Step 1

2- Then click Enviroment Variables...

Step 2

3- Then fill variable name and variable value

Step 3

Variable Name :-path

Variable Value :-C:\Program Files (x86)\Java\jdk1.6.0_18\bin


How many ways can we write a java program

There are many ways to write a java program. The modifications that can be done in a java program are given below:

1) By changing sequence of the modifiers, method prototype is not changed.

Let's see the simple code of main method.


public static  void main(String args[])

2) subscript notation in java array can be used after type, before variable or after variable.

Let's see the different codes to write the main method.

public static void main(String[] args)
public static void main(String []args)
public static void main(String args[])

3) You can provide var-args support to main method by passing 3 ellipses (dots)

Let's see the simple code of using var-args in main method. We will learn about var-args later in Java New Features chapter.

public static void main(String... args)

4) Having semicolon at the end of class in java is optional.

Let's see the simple code.

class A{
static public void main(String... args){
System.out.println("hello java4");
}
}


Valid java main method signature

public static void main(String[] args)
public static void main(String []args)
public static void main(String args[])
public static void main(String... args)
static public void main(String[] args)
public static final void main(String[] args)
final public static void main(String[] args)
final strictfp public static void main(String[] args)


Invalid java main method signature

public void main(String[] args)
static void main(String[] args)
public void static main(String[] args)
abstract public static void main(String[] args)