Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Y {
- private static void print(Object object) {
- System.out.println("object");
- }
- private static void print(Exception excep) {
- System.out.println("exception");
- }
- private static void print(ArithmeticException npe) {
- System.out.println("Arithmetic Exception");
- }
- public static void main(String[] args) {
- String str = null;
- print(null); // Arithmetic Exception is getting printed
- print(str); // object is getting printed
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement