Multiple Choice Question

Quiz Guidelines

 

QID: 
278
Question: 

Which of the following are correct ways to initialize the static variables MAX and CLASS_GUID?

class Widget{
static int MAX; //1
static final String CLASS_GUID; // 2
Widget(){    //3
}
Widget(int k){    //4
}
}

Select 2 options

A. Modify lines //1 and //2 as : static int MAX = 111; static final String
CLASS_GUID = "XYZ123";
B. Add the following line just after //2 : static { MAX = 111; CLASS_GUID =
"XYZ123"; }
C. Add the following line just before //1 : { MAX = 111; CLASS_GUID =
"XYZ123"; }
D. Add the following line at //3 as well as //4 : MAX = 111; CLASS_GUID =
"XYZ123";
E. Only option 3 is valid.

Q&A Set: