TestRes - one.getRes()); System.out.println("This is...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
class Residents { private int res; private int income; Residents() { res = 3; income = 50000; } Residents(int t) { res = t; } Residents(int t,int i) { res = t; income = i; } public void setRes(int r) { res = r; } public int getRes() { return res; } public void setIncome(int i) { income = i; } public int getIncome() { return income; }} public class TestRes { public static void main(String[]args) { Residents one = new Residents(); Residents two = new Residents(20); Residents three = new Residents(13,100000); System.out.println("This is constructor1:The number of residents is = " +
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: one.getRes()); System.out.println("This is constructor1:The total income is = " + one.getIncome()); System.out.println("This is constructor2:The number of residents is = " + two.getRes()); System.out.println("This is constructor2:The total income is = " + two.getIncome()); System.out.println("This is constructor3:The number of residents is = " + three.getRes()); System.out.println("This is constructor3:The total income is = " + three.getIncome()); }}...
View Full Document

This note was uploaded on 10/04/2010 for the course COMPUTER S 106 taught by Professor Moore during the Spring '08 term at Clark Atlanta.

Ask a homework question - tutors are online