Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Replace two of the Modifiers that appear in the Single class to make the code compile. NOTE: Three Modifiers will not be used and four modifiers will remain unchanged.
code:
public class Single{
private static single instance; // Change the Modifier (private,static)
public static Single getInstance(){ // Change the Modifier(public,static)
if(instance == null) instance = create();
return instance;
}
private Single(){} //Change the Modifier
protected Single create() { return new Single(); } //Change the Modifier
}
class SingleSub extends Single{ }
Modifiers :
1. final 2. protected 3. private 4. abstract 5. static
Suresh, when you copy a question from a book or mock exam, we require that you quote your sources. So, please tell us where you copied it from.
As with your previous question: Just try it out for yourself to see what compiles and what doesn't. [ August 18, 2008: Message edited by: Jesper Young ]