address.java

来自「学了2个月java 练习用~ 可以看下 希望同意」· Java 代码 · 共 61 行

JAVA
61
字号
//package ch01;

public class Address
{
	private String country;
	private String city;
	private String street;
	private int code;

	public Address()
	{
		System.out.println("Address null");
	}

	public Address(String country, String city , String street, int code)
	{
		setCountry(country);
		setCity(city);
		setStreet(street);
		setCode(code);
	}

	public void setCountry(String country)
	{
		this.country=country;
	}
	public void setCity(String city)
	{
		this.city=city;
	}
	public void setStreet(String street)
	{
		this.street=street;
	}
	public void setCode(int code)
	{
		this.code=code;
	}

	public String getCountry(){
		return country;
	}
	public String getCity(){
		return city;
	}
	public String getStreet(){
		return street;
	}
	public int getCode(){
		return code;
	}

	public void print()
	{
		System.out.println("Country is :"+country);
		System.out.println("City is :" +city);
		System.out.println("Street is :"+ street);
		System.out.println("code is :"+code);
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?