Tuesday, March 17, 2009

Exercise 5 - Greeting

//ProgrammerName: Joan N. Dominguez
//ProgramName: HelloObject
//Purpose: Programming exercise with the application of the previous lesson in java programming
//Date: March 17,2009
//Subject: Computer Programming 3
//Instructor: Dony Dongiapon


import java.util.Scanner;

public class HelloObject {

  public static void main(String[]args) {
      Scanner a = new Scanner(System.in);
      String greeting;
          System.out.print("Enter your Greeting: "); //it is where the greeting that is printed by the object given by the user.
          greeting = a.nextLine();
          System.out.println("\n");
          System.out.print(greeting);
          System.out.println();
  }
   
   

}

--------------

//Output of this program:

Enter Greeting: 

Hello Sir!

Hello Sir!


No comments:

Post a Comment