第八次上机练习

package Wxte;

public class Rectangle {
	char color;
    int cpu;
    
    public void show(){
        System.out.println("笔记本颜色是  " + color);
        System.out.println("笔记本cpu型号  " + cpu);
    }
    
}

  

package Wxte;

import java.util.Scanner;

public class Mask {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Rectangle a1 = new Rectangle();
	        a1.color = '黑';
	        a1.cpu = 2233;
	        a1.show();
	        


	}}

  

package Wxte;

public class Person {
	   String name ;
	   double height;
	   int age ;
public void sayHello(){
	   System.out.println("hello,my name is"+name);
	   System.out.println("my height is" +height);
	   System.out.println("my age is"+age);
}
}

  

package Wxte;

public class Mast {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		 Person zhangsan = new Person();
	        
	        zhangsan.name = "zhangsan";
	        zhangsan.age = 43;
	        zhangsan.height=1.73;
	        
	        Person lishi = new Person();
	        lishi.name = "lishi";
	        lishi.height = 1.74;
	        lishi.age = 44;
	        
	        zhangsan.sayHello();
	        lishi.sayHello();
	    }
	}

  

posted @ 2020-04-23 13:36  Demens  阅读(110)  评论(0编辑  收藏  举报