Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 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(StringBuffer y)
  8. {
  9. System.out.println(“StringBuffer-args”);
  10. }
  11. public static void main(String args[])
  12. {
  13. Test t = new Test();
  14. t.m1(new String()); ——>String
  15. t.m1(new StringBuffer()); ——>StringBuffer
  16. t.m1(null);——>error reference to m1()is ambiguous
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement