I'm using the Scanner class and need help in setting up get and set methods for where the program asks the user to enter a first name and a last name as String type.( 2 methods, 1 for first, 1 for last) I need to know how to store the names because...
I am creating a client of the first class and need to call the methods in order to display what the user inputted at the end of the program.
Scanner in = new Scanner (System.in).useDelimiter(' ');
System.out.print("Full name (ex. John Smith): ");
String first = in.next();
String last = in.next();
Client obj = new Client ( first, last );
Then writing the get methods only consists of returning the necessary field. The chances of an object representing a person needing to change the name are very slim, so set methods don't make much sense except in very specific situations.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.