首页上一页 1 下一页尾页 1 条记录 1/1页
Java中this使用看不懂了,哪个大佬讲讲详细点
发表在Java图书答疑
2020-06-29
《零基础学Java》第6章 面向对象编程基础
是否精华
是
否
版块置顶:
是
否
public class Demon { final static double PI = 3.1415926; public static void main(String[] args) { double radius = 3.0; double area = Demon.PI * radius * radius; double valume = 4/3 * Demon.PI * radius * radius * radius; Circular yuan = new Circular(radius,area); Spherical qiu = new Spherical(radius,valume); } } class Circular{ double radius; double area; public Circular(double radius,double area) { this.radius = radius; this.area = area; System.out.println("圆的半径为"+this.radius+"圆的面积是"+this.area); } } class Spherical{ double radius; double valume; public Spherical(double radius,double valume) { this.radius = radius; this.valume = valume; System.out.println("球的半径为"+this.radius+"圆的体积是"+this.valume); } }