What will the compilation result be?

package com.one;

import static com.two.Two.*;

public class One {
    int x1 = Two.tiger; //1
    int x2 = tiger;  //2
    int x3 = com.two.Two.tiger; //3
    int x4 = two.Two.tiger; //4
}
Second file:

package com.two;

public class Two {
    public static int tiger = 1414;
}
Explanation
Compiler will show two errors:
In line
int x1 = Two.tiger; //1
Because class Two is not imported, only static methods and variables are imported

And in line
int x4 = two.Two.tiger; //4
Because there is no package two
Java
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback