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 Ideone
  9. {
  10. public Ideone(int a, int b){
  11. this.a=a;
  12. this.b=b;
  13. count++;
  14. }
  15. public int count=0; // вот в этом месте убрав static будет ошибка
  16. private int a,b;
  17.  
  18. public static void main (String[] args) throws java.lang.Exception
  19. {
  20. Ideone t1 = new Ideone(1,2);
  21. System.out.println(t1.count);
  22. }
  23. }
Success #stdin #stdout 0.07s 380160KB
stdin
Standard input is empty
stdout
1