Q: In the following code, what are the legal type
types for the variable vari, which is declared on line 2?
1. class C {
2. public ??? vari;
3. public static void main(
String[] args) {
4. foo(vari);
5. }
6. static void foo(float f){
7. System.out.println("f=" + f);
8. }
9. }
a) boolean
b) byte
c) char
d) double
e) float
f) int
g) long
h) short
I think the answers are b,c,e,f,h. but the correct answers are b,c,e,f,g,h. I compile the g
answer, it is really ok, I don't know why. Can someone help me?