• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Private modifier problem

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Prasad Kharkar
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just change the statement


to


this should solve the problem
 
Ankit Garg
Sheriff
Posts: 9528
32
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic