Tuesday 26 July 2011

Your First Programe in Java

class FirstPro{

public static void main(String agr[]){
System.out.println("Welcome to  your First Java Programe");
}

}

Explaination:- class is keyword for defination a class in java on which we create multiple object of this class.

public is a acess modifier which means this function is public for all datamember of the class.
static keyword is used to associate the function with class and not with its object,here main() is function which is public as well as statics which means datamember and datafunction can access it and can use it which class name like this First.functionName()// here fucnitonName is a static function. you dont need to creat an object of the class to call a static function.

void keyword mean  function will not return us any keyword.


compile the programe with javac the compiler of the javalanguage comes with jkd1.6// you may download it form web.
javac FirstPro.java
java FirstPro // do this commad to run the programe in  DOS Environment.

No comments:

Post a Comment