Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public class Y {
  2. private static void print(Object object) {
  3. System.out.println("object");
  4. }
  5.  
  6. private static void print(Exception excep) {
  7. System.out.println("exception");
  8. }
  9.  
  10. private static void print(ArithmeticException npe) {
  11. System.out.println("Arithmetic Exception");
  12. }
  13.  
  14.  
  15.  
  16. public static void main(String[] args) {
  17. String str = null;
  18. print(null); // Arithmetic Exception is getting printed
  19. print(str); // object is getting printed
  20. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement