wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Why it shows error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Why it shows error?" Watch "Why it shows error?" New topic
Author

Why it shows error?

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9466
    
    2

Hi helpers,

Considering the code below,


So I thought i is local to public void amethod(Ref r), so I declared the variable i right before Ref ref = new Ref(); and even then Iam getting the same error? Can anyone help me on this?

Regards,
Jothi Shankar Kumar. S


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Rajesh Kadle
Greenhorn

Joined: Sep 06, 2004
Posts: 26
Yes, as you said i is local. We should make it class/instance variable to be visible. Please see the change below:


[ October 16, 2006: Message edited by: Rajesh Kadle ]

-Raj
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9466
    
    2

Hi Rajesh,

Even after making i as an instance variable, I'm getting the same error.

Regards,
Jothi Shankar Kumar. S
Rajesh Kadle
Greenhorn

Joined: Sep 06, 2004
Posts: 26
you should use 'r' instead of 'ref'. Error is on this variable:



Change the above code to:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why it shows error?