aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Private modifier problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Private modifier problem" Watch "Private modifier problem" New topic
Author

Private modifier problem

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

scjptest.com


output:
change2
getvalue1
1

i think output should be
change2
getvalue2
2

as we are changing the value in the changeValmethod to 2


OCPJP 6.0 93%
OCPJWCD 5.0 98%
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446
    
    1

just change the statement


to


this should solve the problem

SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9313
    
  17


This statement has no effect. It will assign the value of the same variable to itself i.e. the parameter received by the method. You can think of the code as this


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
Don't get me started about those stupid light bulbs.
 
subject: Private modifier problem