fork download
  1. class Dog{
  2. public double weight;
  3. public double height;
  4. public String name;
  5. public Dog(double w,double h,String n){
  6. weight=w;
  7. height=h;
  8. name=n;
  9. }
  10. public void eat(){
  11. weight+=0.1;
  12. }
  13. public void bark(){
  14. System.out.println(weight);
  15. System.out.println(height);
  16. System.out.println(name);
  17. }
  18. }
  19. class Hoge{
  20. public static void main(String[]args){
  21. Dog ta = new Dog(10.5, 0.8, "taro");
  22. ta.bark();
  23. ta.eat();
  24. ta.bark();
  25. }
  26. }
  27.  
Success #stdin #stdout 0.11s 55220KB
stdin
Standard input is empty
stdout
10.5
0.8
taro
10.6
0.8
taro