标签:package public double return
package com.ctu.java.exer; public class TestCircle { public static void main(String[] args){ Circle c1 = new Circle(); c1.radius = 2.3; double area = c1.findArea(); System.out.println(area); c1.setRadius(4.5);//c1.radius = 4.5; System.out.println(c1.findArea()); } } class Circle{ double radius = 1.0; //public void findArea(){ //System.out.println(3.14*radius*radius); //} public double findArea(){ return 3.14*radius*radius ; } public double getRadius(){ return radius; } public void setRadius(double r){ radius = r; } }
标签:package public double return
原文地址:http://9815936.blog.51cto.com/9805936/1601628