SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master Did a rm -R / to find out that I lost my entire Linux installation!
Originally posted by Jothi Shankar Kumar Sankararaj: Hi Ranchers, Consider the following code, class Test { public static void main(String[] args) { Test t = new Test(); t.test(1.0, 2L, 3); } void test(double a, double b, short c) { System.out.println("1"); } void test(float a, byte b, byte c) { System.out.println("2"); } void test(double a, double b, double c) { System.out.println("3"); } void test(int a, long b, int c) { System.out.println("4"); } void test(long a, long b, long c) { System.out.println("5"); } } Why it prints 3 instead of 2? Regards, Jothi Shankar Kumar. S
~ Anand, SCJP 1.5, SCWCD 1.5
Hi, 2 is not printed because third parameter is integer and it can not converted to byte without explicit cast. Regards, Anand
So when it comes to method invocation, any number of type 3.0, 55.0 is treated as double and numbers like 45, 888888 are treated as int. am I right?