zoukankan      html  css  js  c++  java
  • 第九周上机 张垚

     1. package er;
    
    public class point {
    	 int x;
    	    int y;
    	    point() {
    	               
    	    }
    	    point(int dx,int dy) {
    	        x+=dx;
    	        y+=dy;
    	               
    	    }
    	    void movepoint(int p1,int p2) {            
    	        p1=x*2;
    	        p2=y*2;
    	        System.out.println("p1的坐标为"+p1+"
    "+"p2的坐标为"+p2);              
    	    }
    }   
    	 
    package er;
    
    public class person {
    	public static void main(String[] args) {
            point p=new point();
            p.x=6;
            p.y=2;
           p.movepoint(p.x,p.y);
     }
    }
    

      2.

    package er;
    
    public class point {
    	int length;
    	int width;
    
    	point(int width, int length) {
    		this.width = width;
    		this.length = length;
    	}
    
    	void getArea() {
    		System.err.println("面积:"+width*length);
    	}
    
    	void getPer() {
    		System.out.println("周长:"+(width+length)*2);
    	}
    
    	void showAll() {
    		System.out.println("长:"+length+"  宽:"+width);
    	}
    	public static void main(String[] args) {
    		point a = new point(2, 5);
    		a.getArea();
    		a.getPer();
    		a.showAll();
    		
    	}
    }
    

      3.

    package er;
    
    public class point {
    		
    		char color;
    		int cpu;
    
    	    point() {
    	   }
    	     point(char color, int cpu) {
    			this.color = color;
    			this.cpu = cpu;
    		}
    
    	    void point() {
    			System.out.println("颜色:"+color);
    			System.out.println( "型号:"+cpu);
    		}
    	public static void main(String[] args) {
    		point p= new point('p',4689);
    		p.point();
    	   }
    	}
    

      4.

    package test;
    
    public class person {
    	 String name;
    	    double height;
    	    int age;
    	     
    	    public void sayHello(){
    	     System.out.println("hello,my name is " + this.name );
    	    }
    	    public void Value(String name, int age, double height){
    	     this.name = name;
    	     this.age = age;
    	     this.height = height;
    	    }
    	       
    	}
    package test;
    
    public class personcreate {
    	public static void main(String[] args) {
            // TODO Auto-generated method stub
            person p1 = new  person();
            p1.Value("zhangsan",33,1.74);
            p1.sayHello();
            person p2 = new  person();
            p2.Value("lishi",44,1.74);
            p2.sayHello();
     }
    }
    

      

  • 相关阅读:
    css 定位
    css inline忽略宽和高
    css clear属性
    关系型数据库与nosql
    链接标签<a>的css定义规则
    1em=16px
    text-align的justify属性
    2393Cirno的完美算数教室 容斥
    bzoj4665小w的喜糖 dp+容斥
    bzoj4558[JLoi2016]方 容斥+count
  • 原文地址:https://www.cnblogs.com/ZXCVBNM1314/p/12808960.html
Copyright © 2011-2022 走看看