sample java program

import java.util.*;
class Myclass
{
public static void man(String args[])
{
System.out.println(" welcome to programming world ");
}
}

Executing and compiling:-
c:>javac Myclass.java
c:>java Myclass

Out put :-
welcome to programming world

Explanation:- 
warme welcome to java first program.

the first line of the program tell that your are importing all utilities from java
the second line is a class decleration in that the class is a keyword and Myclass is class name.( note:- it is good programming habit to start class name as capital letter).

Next we are declaring a user defined function main

next we are printing a message " welcome to programming world"



No comments:

Post a Comment

Note: only a member of this blog may post a comment.