怎么同时输出JAVA类里面的两个属性?

import java.util.*;
class cylinderTest{
  public static void main(String args[]){
  cylinder c1=new cylinder();
  c1.getInfo();
  }
}
class cylinder{
  double r;
  double h;
  cylinder(){
    this.r=5.0;
    this.h=5.0;
  }
  cylinder(double r,double h){
    this.r=r;
    this.h=h;
  }
  double getArea(){
    return(Math.PI*r*r*h);
  }
  double getV(){
    return((Math.PI*2*r*h)+(Math.PI*r*r));
  }
  void getInfo(){
	System.out.println("Area="+getArea()+" V="+getV());
}
}

你可能感兴趣的:(java,java)