Program/Java Programming

패키기 상속(Package import)

Hue Kim 2012. 10. 1. 06:04
package pack1.pack2;

public class Balance {
	
	String name;
	double balance;

	public Balance(String n, double b) {

		name = n;
		balance = b;
	}

	public void show() {

		System.out.println(name + ": $" + balance);
	}
}
import pack1.pack2.*;

class TestBalance {

	public static void main(String[] args) {

		Balance test = new Balance("David",200);
		test.show();
	}

}