public class Phone {

		//属性
		String brand;
		double price;


		//行为:
		public void call(){
			System.out.println("手机在打电话");
		}

		public void playGame(){
			System.out.println("手机在玩游戏");
		}
		}
		
        
            
		public class PhoneTest {
    	public static void main(String[] args) {
        //创建手机的对象
        Phone p = new Phone();

        //叫做给手机赋值
        p.brand = "小米";
        p.price = 1999.98;

        //获取手机对象中的值
        System.out.println(p.brand);
        System.out.println(p.price);


        //调用手机中的方法即可
        p.call();
        p.playGame();


        Phone p2 = new Phone();
        p2.brand = "苹果";
        p2.price = 8999;

        p2.call();
        p2.playGame();
    	}
		}
		
        
            
		
		public class StringTest {
    	public static void main(String[] args) {

        String s  = "wefipuhweiduhwiuehd";

        int len = s.length();
        System.out.println(len);


        String ss = s.toUpperCase();
        System.out.println(ss);
    	}
		}		
		
        
            
		public class GirlFriend {
		//属性
		String name;
		int age;
		String gender;

		//行为
		public void sleep(){
			System.out.println("女朋友在睡觉");
		}

		public void eat(){
			System.out.println("女朋友在吃饭");
		}
		}
		
        
            
		public class GirlFriendTest {
    	public static void main(String[] args) {
        //创建女朋友的对象
        GirlFriend gf1 = new GirlFriend();
        gf1.name = "小诗诗";
        gf1.age = 18;
        gf1.gender = "萌妹子";

        System.out.println(gf1.name);
        System.out.println(gf1.age);
        System.out.println(gf1.gender);

        gf1.eat();
        gf1.sleep();


        System.out.println("===================");
        GirlFriend gf2 = new GirlFriend();
        gf2.name = "小丹丹";
        gf2.age = 19;
        gf2.gender = "萌妹子";

        System.out.println(gf2.name);
        System.out.println(gf2.age);
        System.out.println(gf2.gender);

        gf2.eat();
        gf2.sleep();
    	}
		}
		
        
            
		public class GirlFriend {
		//属性
		private String name;
		private int age;
		private String gender;


		//针对于每一个私有化的成员变量,都要提供get和set方法
		//set方法:给成员变量赋值
		//get方法:对外提供成员变量的值

		//作用:给成员变量name进行赋值的
		public void setName(String name){
			//局部变量表示测试类中调用方法传递过来的数据
			//等号的左边:就表示成员位置的name
			this.name = name;
		}

		//作用:对外提供name属性的
		public String getName(){
			return name;
		}


		//age
		//setAge:给成员变量age进行赋值的
		//getAge:对外提供成员变量age的值
		public void setAge(int age){
			if(age >= 18 && age <= 50){
				this.age = age;
			}else{
				System.out.println("非法参数");
			}
		}

		public int getAge(){
			return age;
		}


		//gender
		public void setGender(String gender){
			this.gender = gender;
		}

		public String getGender(){
			return gender;
		}


		//行为
		public void sleep() {
			System.out.println("女朋友在睡觉");
		}

		public void eat() {
			System.out.println("女朋友在吃饭");
		}
		}
		
        
            
		public class GirlFriendTest {
    	public static void main(String[] args) {
        //创建女朋友的对象
        GirlFriend gf1 = new GirlFriend();
        //赋值
        gf1.setName("小诗诗");
        gf1.setAge(18);
        gf1.setGender("女");

        System.out.println(gf1.getName());
        System.out.println(gf1.getAge());
        System.out.println(gf1.getGender());

        gf1.eat();
        gf1.sleep();
    	}
		}
		
        
            
		public class GirlFriend {
		//属性
		private int age;//0


		public void method() {
			//int age = 10;
			System.out.println(age);
			System.out.println(this.age);
		}
		}
		
        
            
		public class GirlFriendTest {
    	public static void main(String[] args) {
        GirlFriend gf1 = new GirlFriend();
        gf1.method();
    	}
		}
		
        
            
		public class Student {
		private String name;
		private int age;


		//如果我们自己没有写任何的构造方法
		//那么虚拟机给我们加一个空参构造方法
	 /*   public Student(){
			System.out.println("看看我执行了吗?");
		}*/

		public Student(String name,int age){
			this.name = name;
			this.age = age;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public int getAge() {
			return age;
		}

		public void setAge(int age) {
			this.age = age;
		}
		}
		
        
            
		public class StudentTest {
    	public static void main(String[] args) {
        //创建对象
        //调用的空参构造
        //报错的原因:
        //会调用Student的无参构造
        //Student s = new Student();

        Student ss = new Student("zhangsan",23);
        System.out.println(ss.getName());
        System.out.println(ss.getAge());
    	}
		}
		
        
            
		public class User {
		//属性
		private String username;
		private String password;
		private String email;
		private String gender;
		private int age;

		public User() {
		}

		public User(String username, String password, String email, String gender, int age) {
			this.username = username;
			this.password = password;
			this.email = email;
			this.gender = gender;
			this.age = age;
		}

		/**
		 * 获取
		 * @return username
		 */
		public String getUsername() {
			return username;
		}

		/**
		 * 设置
		 * @param username
		 */
		public void setUsername(String username) {
			this.username = username;
		}

		/**
		 * 获取
		 * @return password
		 */
		public String getPassword() {
			return password;
		}

		/**
		 * 设置
		 * @param password
		 */
		public void setPassword(String password) {
			this.password = password;
		}

		/**
		 * 获取
		 * @return email
		 */
		public String getEmail() {
			return email;
		}

		/**
		 * 设置
		 * @param email
		 */
		public void setEmail(String email) {
			this.email = email;
		}

		/**
		 * 获取
		 * @return gender
		 */
		public String getGender() {
			return gender;
		}

		/**
		 * 设置
		 * @param gender
		 */
		public void setGender(String gender) {
			this.gender = gender;
		}

		/**
		 * 获取
		 * @return age
		 */
		public int getAge() {
			return age;
		}

		/**
		 * 设置
		 * @param age
		 */
		public void setAge(int age) {
			this.age = age;
		}

		//快捷键:
		//alt + insert
		//alt + Fn + insert
		//插件PTG 1秒生成标准Javabean
		}
		
        
单词