Hi, whats the problem with my code, I know that print((short) 1) will work and print((Short) 1); won't but why is this happening although I should use the wrapper class Short not the short as I understand ?
package com.codegym.task.task15.task1506;
/*
Something superfluous
*/
//This is a double
//This is an Object
//This is a double
//This is an Integer
//This is a double
public class Solution {
public static void main(String[] args) {
print(1.0);
print((Short) 1);
print((Double)1.0);
print((Integer) 1);
print((Double) 1.0);
}
public static void print(Integer i) {
System.out.println("This is an Integer");
}
public static void print(int i) {
System.out.println("This is an Integer");
}
public static void print(Short i) {
System.out.println("This is an Object");
}
public static void print(Object i) {
System.out.println("This is an Object");
}
public static void print(double i) {
System.out.println("This is a double");
}
public static void print(Double i) {
System.out.println("This is a double");
}
public static void print(float i) {
System.out.println("This is a Double");
}
}