11 Replies Latest reply on Apr 4, 2008 5:11 PM by 807601

    How to access variables from other classe through getter ?

      Hi !

      I have 10 classes

      Cau_1.java containing char Cau_1_Answer;
      Cau_2.java... Cau_2_Answer;
      Cau_10.java... Cau_10_Answer;

      and another class Resume_grammar.java with char[] AnswerList = new Char[10] used to hold cau_1_Answer, Cau_2_Answer...Cau_10_Answer.
      but I don't success to get them.

      In Cau_1.java, I do :

      private static char Cau_1_Answer;
      static char getCau_1_Answer() {
                return Cau_1_Answer;
           static void setCau_1_Answer(char cau_1_Answer) {
                Cau_1_Answer = cau_1_Answer;
      if (a.isChecked()) {Cau_1_grammar.setCau_1_Answer('a');}
      if (b.isChecked()) {Cau_1_grammar.setCau_1_Answer('b');}
      if (c.isChecked()) {Cau_1_grammar.setCau_1_Answer('c');}
      if (d.isChecked()) {Cau_1_grammar.setCau_1_Answer('d');}

      Cau_2, Cau_3...are the same way.

      in Resume_grammar.java :

           static char[] AnswerList = new char[10];     
      AnswerList[0] = Cau_1_grammar.getCau_1_Answer();
      AnswerList[9] = Cau_10_grammar.getCau_10_Answer();

      When I make AnswerList display, all is null (nothing displayed).

      Please help ! What I do wrong ?

      Thank you !