Home Tutorial Java Scjp Part1 SCJP Module-1 Question-20

 
 

Share on Google+Share on Google+
SCJP Module-1 Question-20
Posted on: July 8, 2010 at 12:00 AM
Advertisement
The above program checks and fresh up your core Java knowledge and it helps in preperation for SCJP examination.

Given a sample code:

class Sample {
int x = 100;

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

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

What will be the result of above code ?

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

Answer:

(3)

Advertisement

Related Tags for SCJP Module-1 Question-20:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 8, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com