Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Test
- {
- public void m1(int x)
- {
- System.out.println(“int-arg”);
- }
- public void m1(float y)
- {
- System.out.println(“float-arg”);
- }
- public static void main(String args[])
- {
- Test t = new Test();
- t.m1(10);——>int-arg
- byte b=20;
- t.m1(b);——>int-arg
- t.m1(‘a’);——>int-arg
- t.m1(100L);——>float-arg
- t.m1(10.5f);——>float-arg
- t.m1(10.5);——>error
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement