1 | Can a class can be declared protected? |
2 | public strictfp class Myclass {
// ... contents of class here ...
}
is this declaration valid? |
3 | Which of the following are true about final variable declaration? |
4 | public class Test {
final int i;
public Test(){
setup();
}
public void setup(){
i=10;
}
}
Will the above code will run? |
5 | public class Test {
final int i;
public Test(){
i=10;
setup();
}
public void setup(){
// setup code
}
}
Will the above code will run? |
6 | public class Test {
public static void main(String[] args) {
final int i;
int a=2,b=3;
double x;
x = a+b;
System.out.println("Result = "+x);
}
}
What is wrong with the above code? |
7 | Can Inner class can be a final class? |
8 | Given:
public class Test {
int Test ;
public void Test(){
double Test;
}
}
will it compile? |
9 | Given:
public abstract class Test {
int Test ;
public void Test(){
double Test;
}
}
is this valid? |
10 | Given:
int calculateSquare(final double i){
i = i*i;
return i ;
}
is this valid? |