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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 438

just change the statement


to


this should solve the problem

SCJP 6 [86%] June 30th, 2010
OCPWCD [84%] March 26th, 2013
If you find any post useful, click the "plus one" sign on the right
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Private modifier problem
 
Similar Threads
compile time constants
What will this program print out? Why?
Overloading wih static methods
exam qs- object orientation- help!
confusion in the output