Publish your story - poem - jokes free online--click here

JAVA

JAVA

Data Types | Class | Inheritance | Interface | Method Overloading | Method Overriding | Abstraction | Final and Super key | Package | Exception Handling | Mutli Thread | Join Thread | Synchronized | DeadLock | Applet



Java is Pure OOPs because each and every statement of JAVA is written in Class.
Let’s make a simple java program to print “hello this is my first java program”.

But before this make sure your PC have already install Java Development Kit (JDK) and you have a text editor (E.g. --> NotePad  or NotePad++)
If you have installed JDK
Then Set the java compiler path to System variable
1. Right click on my computer
2. Goto properties
3. Goto advance system setting
4. Click on environment variable
4. under user variable click on new
Put   variable name= path
                And variable value = C:\Program Files \Java\jdk1.7.0_02\bin\         
                                If you have windows 64 bit OS the put Program Files(x86)  instead of Program File
If all goes well  you are ready to make java program
Simple Program In java: ---
public class abc
{
                public static void main(String arg[])
                {
                                System.out.println(“hello this is my first java program”);
                }
}

Now save this file any where you want (D:\\java_prog\abc.java)
Make sure the file name must be the name of main class

Compiling and Executing Java program: ---
Press (windows key + R ) or goto run and type cmd and hit enter  to open command prompt

Now change the directory where you have saved your java file (e.g. D:\\java_prog\)

And type        javac filename.java   (e.g. javac abc.java)
If your program has error then fixed it in source file and save it and recompile it

Then type  java filename  to execute  (e.g. java abc)

Congratulation you have successfully executed a java program.:)

No comments:

Post a Comment