Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class Person { private static int lastId = 1 0 0 0 ; private String firstName; private String lastName; private int id; public Person

public class Person {
private static int lastId =1000;
private String firstName;
private String lastName;
private int id;
public Person(String firstName, String lastName){
this.firstName = firstName;
this.lastName = lastName;
this.id =++lastId;
}
public String getFirstName(){
return firstName;
}
public String getLastName(){
return lastName;
}
public String getFullName(){
return firstName +""+ lastName;
}
public int getId(){
return id;
}
public void printFirstName(){
System.out.println("First Name: "+ firstName);
}
public void printLastName(){
System.out.println("Last Name: "+ lastName);
}
public void printId(){
System.out.println("ID: "+ id);
}
@Override
public String toString(){
return "Person [id="+ id +", firstName="+ firstName +", lastName="+ lastName +"]";
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

In regards to camelids, the term kush is used to describe what?

Answered: 1 week ago