Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Adult {
- private String name, work;
- private int high;
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getWork() {
- return work;
- }
- public void setWork(String work) {
- this.work = work;
- }
- public int getHigh() {
- return high;
- }
- public void setHigh(int high) {
- this.high = high;
- }
- public Adult(String name, String work, int high) {
- this.name = name;
- this.work = work;
- this.high = high;
- }
- public Adult(String name, int high) {
- this(name, null, high);
- }
- public void show() {
- System.out.printf("the persons are: ");
- if (work != null)
- System.out.println(name + " " + work + " " + high);
- else {
- System.out.println(name + " " + high);
- }
- }
- }
Add Comment
Please, Sign In to add comment