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. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Foo foo = new Foo();
  13. foo.test();
  14. }
  15. }
  16.  
  17. class Bar
  18. {
  19. public void test()
  20. {
  21. this.testPrivate();
  22. this.testPublic();
  23. }
  24.  
  25. public void testPublic()
  26. {
  27. System.out.println("Bar::testPublic");
  28. }
  29.  
  30. private void testPrivate()
  31. {
  32. System.out.println("Bar::testPrivate");
  33. }
  34. }
  35.  
  36. class Foo extends Bar
  37. {
  38. public void testPublic()
  39. {
  40. System.out.println("Foo::testPublic");
  41. }
  42.  
  43. private void testPrivate()
  44. {
  45. System.out.println("Foo::testPrivate");
  46. }
  47. }
Success #stdin #stdout 0.08s 32344KB
stdin
Standard input is empty
stdout
Bar::testPrivate
Foo::testPublic