code_junkie

Accessing non top-level class without a top level class in Java

Nov 12th, 2011
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. class A
  2. {
  3. public void foo()
  4. {
  5. System.out.println("Executing foo");
  6. }
  7. }
  8.  
  9. class B
  10. {
  11. public void bar()
  12. {
  13. System.out.println("Executing bar");
  14. }
  15. }
  16.  
  17. public class Test {
  18. public static void main(String... args) {
  19. A a = new A();
  20. a.foo();
  21. B b = new B();
  22. b.bar();
  23. }
  24. }
Add Comment
Please, Sign In to add comment