Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. class Test
  2. {
  3. public void m1(String x)
  4. {
  5. System.out.println(“String-args”);
  6. }
  7. public void m1(Object o)
  8. {
  9. System.out.println(“Object-args”);
  10. }
  11. public static void main(String[]args)
  12. {
  13. Test t = new Test();
  14. t.m1(new String()); ——>String args
  15. t.m1(new Object()); ——>object args
  16. t.m1(null); ——>String args
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement