Question: A null value can be useful to model an optional value that may or may not be present. The following Name class sets last to
A null value can be useful to model an optional value that may or may not be present. The following Name class sets last to null when a name is constructed without a last name. Rearrange the lines to produce the code for the class. First show the instance variables.
How to use this tool
Unused
first fname;
if last null return first;
last lname;
private String first;
else return last first;
private String last;
last null;
first fname;
Name.java
Load default template...
import java.util.Scanner;
public class Name
public NameString fname
public NameString fname, String lname
public String tostring
public static void main String args
Scanner in new Scanner
System.in;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
