• 5-1作业


    package h_m5_1;
    
    import java.awt.Point;
    
    /*
     * 练习一
     */
    public class Ponit01 {
        private int x ;
        private int y ;
        
    public Ponit01() {
        
                }
        public Ponit01(int x, int y) {
            super();
            this.x = x;
            this.y = y;
        }
        
    @Override
        public String toString() {
            return "Ponit01 [x=" + x + ", y=" + y + "]";
        }
    
    public int getX() {
        return x;
    }
    public void setX(int x) {
        this.x = x;
    }
    public int getY() {
        return y;
    }
    public void setY(int y) {
        this.y = y;
    }
    public void movePoint(int a,int b){
        this.x=a;
        this.y=b;
        }
    
    
        public static void main(String[] args) {
            Ponit01 p1 = new Ponit01(2,3);
            Ponit01 p2= new Ponit01();
            p1.movePoint(5, 6);
            System.out.println(p1);
            p2.setX(8);
            p2.setY(9);
            System.out.println(p2);
            p2.movePoint(1, 2);
            System.out.println(p2);
    
            
        }
    
    }
    package h_m5_1;
    /*
     * 练习二
     */
    public class Reactangle {
        private int width;
        private int height;
    
        public Reactangle(int width, int length) {
            super();
            this.width = width;
            this.height = length;
        }
        public void getArea(){
            System.out.println("矩形面积:"+width*height);
        }
        public void getZou(){
            System.out.println("矩形的周长是:"+(width+height)*2);
        }
        public void getAll(){
            getArea();
            getZou();
            System.out.println("宽:"+width+","+"高"+height);
        }
        public static void main(String[] args) {
            Reactangle r = new Reactangle(5, 6);
            r.getAll();
        }
    
    }
    package h_m5_1;
    /*
     * 练习三
     */
    public class Person {
        int weight;
        int height;
        String name;
        public Person() {
            // TODO Auto-generated constructor stub
        }
        public Person(int weight, int height, String name) {
            super();
            this.weight = weight;
            this.height = height;
            this.name = name;
        }
        public void sayHello() {
            System.out.println("Hello my name is"+name);              
        }
    
        public static void main(String[] args) {
            Person p= new Person(70, 175, "王兆明");
            p.sayHello();
        }
    
    }
  • 相关阅读:
    EF 使用 oracle
    mysql安装笔记
    解决问题
    第四次冲刺
    第三次冲刺
    SQA
    第二次冲刺
    第一次冲刺,求进步
    Scrum _GoodJob
    我对git 、github的初印象
  • 原文地址:https://www.cnblogs.com/wzm7282/p/12831803.html
Copyright © 2020-2023  润新知