Dear Pepel !
I am even beginner in Java and thank you very much. I get well your
instruction. I still need your help, please see :
In Cau_1, I set instance like this :
...
char Cau_1_Answer;
protected char getCau_1_Answer() {
return Cau_1_Answer;
}
protected void setCau_1_Answer(char cau_1_Answer) {
Cau_1_Answer = cau_1_Answer;
}
....
In the class that access :
char[] AnswerList = new char[10];
...// (1)
protected void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.result_grammar);
AnswerList[0] = Cau_1_grammar.getCau_1_Answer; // AnswerList[0]
assignment
...
The error is Cau_1_grammar.getCau_1_Answer cannot be resolved
If I place AnswerList[0] assignment at (1) , the error is Syntax error on
token ";", { expected after this token after the array initialization.
How can I fix it ?
On Tue, Apr 1, 2008 at 9:06 PM, Pepel <[EMAIL PROTECTED]> wrote:
>
> and in order to access them using an instance of each of the Cau_1...
> Cau_10 classes, the variables have to be public (or access them using a
> public method)
>
> regards.
>
> P.D. This is more a java question than an android question
>
>
> On 4/1/08, Pepel <[EMAIL PROTECTED]> wrote:
> >
> > The class that wants to access the variables from the other class can
> > only access them through an instance of the class! (or if the class Inherit
> > from the Cau_1.. Cau_10 classes)
> >
> > regards,
> >
> >
> > On 4/1/08, LE THANH TUNG <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi !
> > >
> > > I have 10 classes :
> > >
> > > Cau_1.java containing variable char Cau_1_Answer
> > > Cau_2.java containing variable char Cau_2_Answer
> > > ....
> > > Cau_10.java containing variable char Cau_10_Answer
> > >
> > > and another class with char[] AnswerList = char[]{Cau_1_Answer,
> > > Cau_2_Answer,...,Cau_10_Answer}
> > >
> > > Why does the class with AnswerList get error *can not resolve*
> > > *Cau_1_Answer,
> > > can not resolve Cau_2_Answer..*.?
> > >
> > > I keep all the default modifier because they are in the same package.
> > > Even I change in public, it doesn't work either ?
> > >
> > > What I did wrong and how to resolve ? Thanks for help !
> > >
> > > --
> > > Many thanks and regards
> > > LÊ THANH TÙNG
> > > Da Nang, Vietnam
> > >
> > > > > >
> > >
--
Many thanks and regards
LÊ THANH TÙNG
Da Nang, Vietnam
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---