Jul 6, 2014

Java Hello World

To Start Java Development You Must First Setup The Environment For It.If You Are Not Setup The Environment Yet Click Here.

After Setting Up The Java Development Environment, We Can Run Our First Java Application. In order To Do That i'm Using Notepad++ Text Editor. As Beginner Its Good To Code In The Notepad++.

As Good Practice Create A Folder & Name It As Java-codes. Inside The Folder Open Text File. Inside The Text File We Can Write Our Java Codes. First Of All We Have To Create A Class.We Can Give Any Name To Java Class. But Make Sure You Have Given A Meaningful Name.In My Case I'm Calling My Class As HelloWorld.

class HelloWorld {



Now We Have Our Class.Still We Don't Have A Java File.To Make This Text File To A Java File Save This File As "HelloWorld.java".Now We Have Our File.Now We Need The Main Method.Create The Main Method Inside The Class.

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

   }
}

Now We Have Our Main Method.Now We Just Need Is To Print Hello World In The Command Prompt.In Java Its Provide Method Call Print To Print Stuff.Type The Following Complete The Code To Print Hello World.

class HelloWorld {
   public static void main(String args[]){
      System.out.print("Hello World");
   }
}

Now Save The File.Open Command Prompt.Go To File Location That We Created First In The Command Prompt.In My Case Its In The "D" Drive.First We Have To Complie Our Java File & We Have To Take The Class File.In Order To Do That Type Javac HelloWorld.java  , and Press Enter.Now You Will See The Class File Inside The Folder.Now Run The Class File & Check For The Output.

java HelloWorld








No comments:

JWT Token Decode Using Jquery

When it come to authentication we use many mechanism. Ones the user authenticated we must keep these details somewhere safe. So we can share...