Modal Box

First Program in Java

To make your first program in java, first you need to install JDK .
 Download JDK from the following link :
   https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Select your java version as per your operating system. For Windows, select X86 for 32 bit operating system and X64 for 64 bit operating system.
For your operating system configurations, you can check them in My Computer properties.

Once your setup is downloaded, install it. It is better to install java in that drive for which you have the permission to write files, otherwise, first you’ll have to set path for java (we will discuss it later).

Now create your first program in BIN directory and save the file with extension .java

class SharpTutorial
{
public static void main(String args[])
{
String t="Welcome to Sharp Tutorial";
System.out.println("Hello "+t);
}
}

Compile & run this program on command line as following commands :

Command to compile

  > javac <file-name>.java
   eg: javac SharpTutorial.java
   (if SharpTutorial.java is the file here)

To run java class following is the command.

  >java <class-name> <command line arguments optional> .....
>java SharpTutorial

=>  Class name is case sensitive here.

Output of the above program is following:

  "Hello Welcome to Sharp Tutorial "

If you are using Netbeans or Ecliple editor ;
 Just simply create a project and run the file, and the java compiler is invoked automatically.

Video/ C Introduction

Watch video in full size
Wordpress Social Share Plugin powered by Ultimatelysocial