package 面向对象编程; public class juxing { double chang; double kuan; juxing(double chang,double kuan) { this.chang=chang; this.kuan=kuan; } //计算面积 double getMianJi() { return this.chang*this.kuan; } public static void main(String[]args) { juxing myJX=new juxing(1,5); System.out.println("矩形的面积="+myJX.getMianJi()); } }
时间: 2024-10-12 08:55:07