java 的一些简单应用

package java_program;
这个是我也不知道为什么自己给我加的一个包打的一个包

//这是一个定义的类,Java中所有的东西都是类:

public class Customer {
	//定义:
	String name , address, telephone;
	
	构造一些类里面的函数:
	String getname() {
		
		return name ;
	}
	void  setname( String name ) {
		
		this.name = name;
	}
	
	
	String getaddress() {
		
		return address;
	}
	void setaddress( String address ) {
		
		this.address = address;
	}
	
	
	String gettelephone() {
		
		return telephone ;
	}
	void settelephone( String telephone ) {
		
		this.telephone = telephone;
	}
	
	//主函数在这里
	public static void main(String arges[]) {
		
		Customer customer1 = new  Customer() ;
		Customer customer2 = new  Customer() ;
		
		customer1.setname("小芳 ");
		customer1.settelephone("110");
		customer1.setaddress("人民东路六号民警大队");
		
		customer2.setname("小强");
		customer2.setaddress("六号房二间三墙二沟3号");
		customer2.settelephone("对不起电话太大搬不进洞");
		
		System.out.println(customer1.getname());
		System.out.println(customer1.getaddress());
		System.out.println(customer1.gettelephone());
		
		System.out.println(customer2.getname());
		System.out.println(customer2.getaddress());
		System.out.println(customer2.gettelephone());
	}
}

你可能感兴趣的:(java,笔记)