Thursday, March 19, 2009

Exercise 5 --- HelloObject

/* Programmer: Maribelle Lacno
  * Program name: Hello
  * Subject: IT134_Computer Programming 3 
  * Instructor: Mr. Dony Dongiapon 
  * Date Started: 03/16/09 
  * Date Finished: 03/18/09 
  * Purpose: To write a version of the HelloObject program 
  *     where the greeting that is printed by the object is given 
  *     by the user. 
*/

import java.util.*;

public class Hello{
Scanner scan = new Scanner(System.in);
public Hello(){
System.out.println("Enter greeting:");
String greeting = scan.nextLine();
System.out.println();
System.out.print(greeting);
}
public static void main(String[] args){
Hello greeting = new Hello();
}
}

No comments:

Post a Comment