Advertisement
d1i2p3a4k5

19.User defined packages

Oct 18th, 2014
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. package p;
  2. public class AB
  3. {
  4.     public void display()
  5.     {
  6.         System.out.println("This is class AB");
  7.     }
  8. }
  9. package p;
  10. public class CD
  11. {
  12.     public void display()
  13.     {
  14.         System.out.println("This is class CD");
  15.     }
  16. }
  17. import p.*;
  18. class ABCD
  19. {
  20.     public static void main(String args[])
  21.     {
  22.         AB a1 = new AB();
  23.         a1.display();
  24.         CD a2 = new CD();
  25.         a2.display();
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement