Create a class named Person that includes fields for last name, first name, and zip code. Include a default constructor that initialize last name, first name and zip code to ‘X’ if no arguments are supplied. Also include a display method, displayPerson() to display Person details. Create a test class (main class) called TestPerson where your main() is located. In main(), instantiate and display two Person objects: one that uses default values, and one for which you supply your own values.
ShamirSuhaimi 0 Newbie Poster
Recommended Answers
Jump to Postif you don't know that, it means your reading comprehension is zero.
Nothing we can do is going to change that.
Jump to PostYou already have a default constructor (line 7). That's where you can set the X values.
All 5 Replies
cgeier 187 Junior Poster
ShamirSuhaimi 0 Newbie Poster
jwenting 1,905 duckman Team Colleague
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Slavi 94 Master Poster Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.