On Jul 26, 2:37 am, "* ^ *" <[email protected]> wrote:
> I get the above error. Relevant code fragment is included below:
>     // An inner class.
>     private class ListCommand{
>         public void process(Items items, Device device){
>             Item[] list=items.list();
>             // Error here. A call to helper method below, not to
> object's toString(). Why?
>             String reply=toString(list);
Thank you all for the emails. One suggested using this statement:
 String reply = <OuterClassName>.this.toString(list);
This works.

But why would the previous call failed. Is not a class member is
visible from an inner class? Any particular reason?
Thank you.
>             device.write(reply);
>         }
>     }
>     // A helper method.
>     private String toString(Item[] list) {
>         String build = "";
>         for(int i=0; i < list.length; i++){
>             build += "Index:"+i+" Element:"+list[i]+"\n";
>         }
>         return build;
>     }
>
> Thank you

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to