fork download
  1. class Dog{
  2. public double weight;
  3. public int age;
  4. public void eat(){
  5. weight += 0.1;
  6. }
  7. }
  8. class Hoge{
  9. public static void main(String[] args){
  10. Dog pochi;
  11. pochi=new Dog();
  12. pochi.weight=10.0;
  13. pochi.age=5;
  14. System.out.println(pochi.weight);
  15. pochi.eat();
  16. System.out.println(pochi.weight);
  17. }
  18. }
  19.  
Success #stdin #stdout 0.08s 55308KB
stdin
Standard input is empty
stdout
10.0
10.1