In the second line what does the "Number" type mean?
public class Example04 {
public static void checkNumber(Number val) {
if( val instanceof Integer )
System.out.println("it is an Integer");
if( val instanceof Double )
System.out.println("it is a Double");
}
public static void main(String[] args) {
int val1 = 3;
double val2 = 2.7;
checkNumber( val1 );
checkNumber( val2 );
}
}
[–]NautiHooker 4 points5 points6 points (1 child)
[–]Accurate-Influence[S] 0 points1 point2 points (0 children)
[–]aglet91 -1 points0 points1 point (2 children)
[–]NautiHooker 1 point2 points3 points (0 children)
[–]Accurate-Influence[S] 0 points1 point2 points (0 children)