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. class Cat {
  11. private int a = 5;
  12. protected int b = 6;
  13. public int c = 7;
  14. }
  15.  
  16. public class CatDemo {
  17. public static void main(String[] args) {
  18. Cat f = new Cat();
  19. System.out.print(" " + f.a);
  20. System.out.print(" " + f.b);
  21. System.out.print(" " + f.c);
  22. }
  23. }
  24.  
  25. public static void main (String[] args) throws java.lang.Exception
  26. {
  27. // your code goes here
  28. }
  29. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:18: error: non-static variable this cannot be referenced from a static context
        Cat f = new Cat();
                ^
Main.java:17: error: Illegal static declaration in inner class Ideone.CatDemo
        public static void main(String[] args) {
                           ^
  modifier 'static' is only allowed in constant variable declarations
2 errors
stdout
Standard output is empty