SCJP Module-1 Question-17


 

SCJP Module-1 Question-17

The program given below checks you knowledge of core Java concepts and program flow. This program is also very useful for preparation for SCJP exams.

The program given below checks you knowledge of core Java concepts and program flow. This program is also very useful for preparation for SCJP exams.

Given a sample code:

class Sample {
int x = 100;

public void checkValue(int x) {
x += 1;
System.out.println(x++);
}

public static void main(String args[]) {
Sample t = new Sample ();
t.checkValue(5);
}}

What will be the result of above code ?

(1)    106
(2)    6
(3)    7
(4)    107

Answer:

(2)

Ads