package com.cainiaoqi;
public class Test4 {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("----------------------------");
System.out.println("|HELLO WORLD |");
System.out.println("----------------------------");
}
}
package com.cainiaoqi;
public class Test5 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Rectangle rec = new Rectangle(3,4);
System.out.println("面积:"+ rec.getE() +"t周长:"+ rec.getL());
}
}
class Rectangle {
int width;
int height;
Rectangle(int width, int height) {
this.width = width;
this.height = height;
}
public int getE() {
return width*height;
}
public int getL() {
return 2*(width+height);
}
}
package com.cainiaoqi;
public class Test5 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Box rec = new Box(3,4,5);
System.out.println("体积积:"+ rec.getVolume());
}
}
class Box {
int width;
int height;
int depth;
Box(int width, int height, int depth) {
this.width = width;
this.height = height;
this.depth = depth;
}
public int getVolume() {
return width*height*depth;
}
}