Submitted by c-admin on Sun, 05/26/2019 - 00:11
Which of the following are keywords in Java?
Select 4 options
A. default
B. NULL
C. String
D. throws
E. long
F. strictfp
Submitted by c-admin on Sun, 05/26/2019 - 00:09
What is meant by "encapsulation"?
Select 1 option
A. There is no way to access member variable.
B. There are no member variables.
C. Member fields are declared private but public accessor/mutator methods are provided to access and change their values.
D. Data fields are declared public and accessor methods are provided to access and change their values.
E. None of the above.
Submitted by c-admin on Sun, 05/26/2019 - 00:06
Consider the following two classes defined in two java source files.
//in file /root/com/foo/X.java
package com.foo;
public class X{
public static int LOGICID = 10;
public void apply(int i){
System.out.println("applied");
}
}
//in file /root/com/bar/Y.java
package com.bar; //1 <== INSERT STATEMENT(s) HERE
public class Y{
public static void main(String[] args){
X x = new X();
x.apply(LOGICID);
}
}
What should be inserted at //1 so that Y.java can compile without any error?
Select 2 options
A. import static X;
B. import static com.foo.*;
C. import static com.foo.X.*;
D. import com.foo.*;
E. import com.foo.X.LOGICID;
Submitted by c-admin on Sat, 05/25/2019 - 23:57
Which of the given options should be inserted at line 1 so that the following code can compile without any errors?
package objective1; // 1
public class StaticImports{
public StaticImports(){
out.println(MAX_VALUE);
}
}
(Assume that java.lang.Integer has a static field named MAX_VALUE)
Select 2 options
A. import static java.lang.Integer.*;
B. static import java.lang.System.out;
C. static import Integer.MAX_VALUE;
D. import static java.lang.System.*;
E. static import java.lang.System.*;
Submitted by c-admin on Sat, 05/25/2019 - 23:53
Consider the directory structure shown in Image 1 that displays available folders and classes and the code is given below:
class StockQuote{
Stock stock;
public StockQuote(Stock s) { }
public void store() throws IOException{
return Util.store(stock); }
public double computePrice(){
return Helper.getPricer(stock).price();
} }
Assuming that the code uses valid method calls, what statements MUST be added to the above class?

Select 4 options
A. package com.enthu.rad.*;
B. import com.enthu.*;
C. package com.enthu.rad;
D. import com.*;
E. import java.io.*;
F. It is not required to import java.io.* or import java.io.IOException because java.io package is imported automatically.
Pages