title: Cannot resolve method in java
body: <p>I have a question object that has 4 answer objects inside.</p>
  
  <p>In question.java I have a method that is:</p>
  
  <pre><code>public Answer getA() {
      return a;
  }
  </code></pre>
  
  <p>and in another method I have:</p>
  
  <pre><code>if (questions.get(randomNum).getA().isCorrect())
                  System.out.println("Correct!");
  </code></pre>
  
  <p>where questions is an arraylist containing my question objects.</p>
  
  <p>This gives me a <strong>"Cannot resolve method getA()"</strong> error and im not quiet sure why.</p>
  
  <p>For reference, </p>
  
  <pre><code>System.out.println(questions.get(randomNum));
  </code></pre>
  
  <p>works perfectly fine in printing out the question and the answers.</p>
  
  <p>Question.java</p>
  
  <pre><code>public class Question {
      private String questionText;
      private Answer a, b, c, d;
  
      public Question(String questionText, Answer a, Answer b, Answer c, Answer d) {
          this.questionText = questionText;
          this.a = a;
          this.b = b;
          this.c = c;
          this.d = d;
      }
  
      public String getQuestionText() {
          return questionText;
      }
  
      public void setQuestionText(String questionText) {
          this.questionText = questionText;
      }
  
      public Answer getA() {
          return a;
      }
  
      public void setA(Answer a) {
          this.a = a;
      }
  
      public Answer getB() {
          return b;
      }
  
      public void setB(Answer b) {
          this.b = b;
      }
  
      public Answer getC() {
          return c;
      }
  
      public void setC(Answer c) {
          this.c = c;
      }
  
      public Answer getD() {
          return d;
      }
  
      public void setD(Answer d) {
          this.d = d;
      }
  
      public String toString() {
          return  questionText +
                  "\nA) " + a +
                  "\nB) " + b +
                  "\nC) " + c +
                  "\nD) " + d;
      }
  }
  </code></pre>
  
  <p>Answer.Java</p>
  
  <pre><code>public class Answer {
      private String answerText;
      private boolean correct;
  
      public Answer(String answerText) {
          this.answerText = answerText;
          this.correct = false;
      }
  
      public String getAnswerText() {
          return answerText;
      }
  
      public void setAnswerText(String answerText) {
          this.answerText = answerText;
      }
  
      public boolean isCorrect() {
          return correct;
      }
  
      public void setCorrect() {
          this.correct = true;
      }
  
      public String toString() {
          return answerText;
      }
  }
  </code></pre>