fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Player1
  9. {
  10. public int hp;
  11. public int place;
  12. public Player1(){
  13. hp=100;
  14. place=0;
  15. }
  16. public void work(){
  17. hp=hp-1;
  18. place=place+1;
  19. }
  20. public void print(){
  21. System.out.println(hp);
  22. System.out.println(place);
  23. }
  24. }
  25. class Ideone
  26. {
  27. public static void main(String[] args){
  28. Player1 p=new Player1();
  29. p.print();
  30. p.work();
  31. p.print();
  32. }
  33.  
  34. }
Success #stdin #stdout 0.08s 16528KB
stdin
Standard input is empty
stdout
100
0
99
1