第十九次发博不知道用什么标题好
1 public class Kettle{ 2 int volume; 3 public Kettle(int water){ 4 volume = water; 5 } 6 7 public int heatingWater(int needWater){ 8 int needWater1=0; 9 if(needWater>volume) 10 System.out.println("装不下"); 11 } 12 else { 13 needWater1=needWater-2; 14 System.out.println(nedWater1); 15 } 16 17 return needWater1; 18 } 19 20 public static void main(String[] args){ 21 22 Kettle k1 = new kettle(60); 23 k1.heatingWater(40); 24 }