Demo entry 6362488

实验一

   

Submitted by anonymous on May 09, 2017 at 05:39
Language: Java. Code size: 701 Bytes.

package shiyan;
public class phone {
	
	private String are;
	private String number;
	static phone zhangsan = new phone();
	public String toString() //重写toString()方法
	{
		return zhangsan.getAre()+"-"+zhangsan.getNumber();
	}
	
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String a = "010";
		String b = "68911205";
		zhangsan.setAre(a);
		zhangsan.setNumber(b);
		System.out.println(new phone());

	}
	

	public String getAre() {
		return are;
	}

	public void setAre(String are) {
		this.are = are;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).