Header Ads Widget

Ticker

6/recent/ticker-posts shiva concept solution is the best programing training center

 HomeJava




1)  Check Java Environment

Java software is installed in the machine or not, In the windows machine, we can check under c:/program files/java folder it should contain JDK and JRE both.

JDK means Java Development Kit, It provides program compilation means convert java program code to byte code.

JRE means Java Runtime Environment, It is used to Execute Java Byte Code to machine code using JVM (Java Virtual Machine), JIT (Just-in-time) Interpreter exist under JVM which is used to execute byte code result.

If the Java environment is not set then install JAVA using JDK and JRE.



2)    Check the Java Environment path that it is set or not.
  
  Open the command prompt and type javac, if javac will be described then the path is set otherwise the path is not set if javac not recognized internal or external command ...


How we set java path:-

Right click on mycomputer----> propeties  ---> Advance System setting ----> Environment Variable-----> New ---> 

variable name:-   path

variable value:-  C:\Program Files\Java\jdk1.8.0_121\bin

press ok, ok and ok, restart command prompt.


3)  now open notepad and write a java program


class Hello
{
   public static void main(String args[])
   {
       System.out.println("hello world");

   }

}




4)  Save this program d:/java5  or anywhere

5)   Open command prompt and type location (d: to switch d drive, cd to change directory)

6)   javac FileName   (   javac Hello.java

7)   java ClassFileName  (java Hello)



Another Program for practice?

class Swap
{
    public static void main(String args[])
    {

        int a=10,b=20,c;
        c = a;
        a = b;
        b = c;
        System.out.println(a); 
        System.out.println(b); 


    }


}
  

SHIVA CONCEPT SOLUTION

Post a Comment

0 Comments