Friday, August 15, 2014

Java first program, How to print something on the screen?

First, in java everything begin with class if we don't have a class then we don't have Java so class is very important and inside the class we have method. that how you going to run a program that's called method.


class first1{

}

Note- First1 is a class name. now we have created the class with name. Now I am going to write the program what I have to do.

class first1{
public static void main(String args[] ){
System.out.println("Welcome to Convict!!!");
}

}

here
method header is public static void main(String args[] )

method body is System.out.println("Welcome to Convict!!!");

print line (println) is a command that something we have print on screen.  


NOTE- Java is a case sensitive language so we have to be aware with Capital and simple Letters.


full coding

class first1{

public static void main(String args[] ){
System.out.println("Welcome to Convict!!!");
}

}


write this in notepad save this program named first1.java

then open your cmd compile your program
type javac first1.java

then run

running method
type java first1

No comments :

Post a Comment