Monday, April 22, 2013

Program to print your name in java

class Name
{
        public static void main(String args[])
        {
                String s="Maitreya";//your name
                System.out.print("My name is "+s);//the + sign is used to join 2 words
        }
 }

basic code (for those who freshly started with java)

//Basic code:
class First
{
        public static void main(String args[])//main function
        {
                System.out.print("Hello");//outputs the word 'Hello'
        }
}