Can someone please help me to understand this. am new to Java .
Short s3=10; //compiler is ok with this because narrowing conversion happens and then autoboxing happens.
Short s5= Short.valueOf((short) 4); //here explicit cast is needed , why ?
Long l =(long) 10; // here explicit casting is needed
Long l2= Long.valueOf(10); //but here no casting is needed . why?
little confused ..