1 1. which modifier should be applied to a method for the lock of object this to be obtained prior to execution any of the method body? a. synchronizedb. abstractc. finald. statice. public
12. the following code is entire contents of a file called example.java,causes precisely one error during compilation: 1)class subclass extends baseclass{ 2) } 3)class baseclass(){ 4) string str. 5) public baseclass(){ 6) system.out.println(“ok”).} 7) public baseclass(string s){ str=s.} 9)} 10)public class example{ 11) public void method(){ 12) subclass s=new subclass(“hello”). 13) baseclass b=new baseclass(“world”). 14) } 15) }
which line would be cause the error? a. 9b. 10c. 11d.12 13. which statement is correctly declare a variable a which is suitable for refering to an array of 50 string empty object? a. string [] ab. string a[]c. char a[][]d. string a[50]f. object a[50]
14. give the following java source fragment: //point x public class interesting{ //do something } which statement is correctly java syntax at point x? a. import java.awt.*.b.package mypackage.c. static int pi=3.14 d. public class myclass{//do other thing…}e. class myclass{//do something…}
15. give this class outline: class example{ private int x. //rest of class body… } assuming that x invoked by the code java example, which statement can made x be directly accessible in main() method of example.java? a. change private int x to public int xb. change private int x to static int x c. change private int x to protected int xd. change private int x to final int x
16. a class design requires that a member variable should be accessible only by same package, which modifier word should be used? a. protectedb. publicc. no modifierd. private