zoukankan      html  css  js  c++  java
  • Java上机作业4.30

    package ak;
    
    public class Point {
    	int x;
    	int y;
    
    	void Ponit() {
    		System.out.println(x);
    		System.out.println(y);
    
    	}
    
    	void Ponit(int x0, int y0) {
    		x = x0;
    		y = y0;
    	}
    
    	void movePonit(int dx, int dy) {
    		x += dx;
    		y += dy;
    		System.out.println("坐标是" + "(" + x + "," + y + ")");
    	}
    	public static void main(String[] args) {
    		Point p1 = new Point();
    		p1.x=1;
    		p1.y=2;
    		p1.movePonit(3, 4);
    		Point p2 = new Point();
    		p2.x=11;
    		p2.y=23 ;
    		p2.movePonit(3,9);
    	}
    }
    	
    

      

    package ak;
    
    
    public class Rectangle {
    	int length;
    	int width;
    
    	public void getArea() {
    		System.out.println(length * width);
    	}
    
    	public void getPer() {
    		System.out.println((length + width) * 2);
    	}
    
    	public void getAll() {
    		System.out.println("长是" + length);
    		System.out.println("宽是" + width);
    		System.out.println("面积是");
    		getArea();
    		System.out.println("周长是");
    		getPer();
    	}
    	void Rectangle(int width1, int length1){
    		length=length1;
    		width=width1;
    		getAll();
    		
    	}
    	public static void main(String[] args) {
    		Rectangle r1 = new Rectangle();
    		r1.Rectangle(4, 6);
    		
    	}
    
    }
    

      

    package ak;
    
    public class Book {
    	static int cpu;
    	static char color;
    
    	public static void all() {
    		System.out.println("颜色是" + color);
    		System.out.println("cpu是" + cpu);
    	}
    
    	static void book(int cpu1, char color1) {
    		cpu = cpu1;
    		color = color1;
    		all();
    	}
    
    	public static void main(String[] args) {
    		Book r1 = new Book();
    		r1.color = '黑';
    		r1.cpu = 9100;
    		r1.all();
    		book(9000, '白');
    
    	}
    }
    

      

    package www;
     
    public class Person {
     
        double height;
        int age;
        String name;
     
        public void sayHello() {
            System.out.println("Hello,my name is "+name);
        }
     
    }
    package www;
     
    public class PersonCreate {
     
        public static void main(String[] args) {
            Person p1=new Person();
            p1.age=34;
            p1.height=1.73;
            p1.name="zhangsan";
            p1.sayHello();
            Person p2=new Person();
            p2.age=44;
            p2.height=1.74;
            p2.name="lishi";
            p2.sayHello();
        }
     
    }
    

      

  • 相关阅读:
    软件命名规则
    从命令行git转到Tortoise
    如何让浏览器不解析html?
    说几点我觉得谷歌浏览器不好的地方
    移动端开发:使用jQuery Mobile还是Zepto
    开源许可证GPL、BSD、MIT、Mozilla、Apache和LGPL的区别
    给大家讲个故事,感受一下什么叫CF。不知道的请认真听。
    cmd中utf-8编码的问题
    web前端关于html转义符的常用js函数
    js实例分析JavaScript中的事件委托和事件绑定
  • 原文地址:https://www.cnblogs.com/hzpiou/p/12807712.html
Copyright © 2011-2022 走看看