QUESTION 3자격증/OCJP_ExamC2018. 7. 20. 00:02
Table of Contents
반응형
QUESTION 3What is the result?1. public class SimpleCalc {2. public int value;3. public void calculate() { value += 7; }4. }and:1. public class MultiCalc extends SimpleCalc {2. public void calculate() { value -= 3; }3. public void calculate(int multiplier) {4. calculate();5. super.calculate();6. value *= multiplier;7. }8. public static void main(String[] args) {9. MultiCalc calculator = new MultiCalc();10. calculator.calculate(2);11. System.out.println("Value is: " + calculator.value);12. }13. }A. Value is: 8B. Compilation fails.C. Value is: 12D. Value is: -12E. The code runs with no output.F. An exception is thrown at runtime.Solution : A
반응형
'자격증 > OCJP_ExamC' 카테고리의 다른 글
QUESTION 6 (0) | 2018.07.21 |
---|---|
QUESTION 5 (0) | 2018.07.21 |
QUESTION 4 (0) | 2018.07.20 |
QUESTION 2 (0) | 2018.07.19 |
QUESTION 1 (0) | 2018.07.19 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상