fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7.  
  8. class A {
  9. private String foo;
  10.  
  11. A () {
  12. foo = "foo";
  13. }
  14. }
  15.  
  16. class B extends Ideone {
  17. public String foo;
  18.  
  19. B () {
  20. super();
  21. foo = "public foo";
  22. }
  23. }
  24.  
  25.  
  26.  
  27. /* Name of the class has to be "Main" only if the class is public. */
  28. class Ideone
  29. {
  30.  
  31.  
  32. public static void main (String[] args) throws java.lang.Exception
  33. {
  34. A a = new A();
  35. B b = new B();
  36.  
  37. // will trigger compilation error: foo has private access in A
  38. // System.out.println(a.foo);
  39. System.out.println(b.foo);
  40.  
  41. // your code goes here
  42. }
  43. }
  44.  
  45.  
  46.  
Success #stdin #stdout 0.09s 320320KB
stdin
Standard input is empty
stdout
public foo