Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. class Test
  2. {
  3. public void m1(int x)
  4. {
  5. System.out.println(“int-arg”);
  6. }
  7. public void m1(float y)
  8. {
  9. System.out.println(“float-arg”);
  10. }
  11. public static void main(String args[])
  12. {
  13. Test t = new Test();
  14. t.m1(10);——>int-arg
  15. byte b=20;
  16. t.m1(b);——>int-arg
  17. t.m1(‘a’);——>int-arg
  18. t.m1(100L);——>float-arg
  19. t.m1(10.5f);——>float-arg
  20. t.m1(10.5);——>error
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement