title: Cannot make a static reference to the non-static field message ..int randomNumber=r.nextInt(message.length);
body: <pre><code>
      String[] message = new String[5];
      public Advisorr(){
      message[0] = &quot;Advice: Never say No&quot;;
      message[1] = &quot;Advice : Don't Betray !&quot;;
      message[2] = &quot;Advice : Stay calm&quot;;
      message[3] = &quot;Advice : b +ve&quot;;
      message[4] = &quot;Advice :Don't  b -ve&quot;;
      }
  
      public static String  getAdvice() {
      Advisorr r=new Advisorr();          
        int randomNumber=r.nextInt(message.length); 
        System.out.println(message[randomNumber]);
    }
      
    }
    
    public class greeter2{
      public static void main(String[] args) {
  
       Advisorr n = new Advisorr();
       System.out.println(n.getAdvice());
      }
    
    }
    
    
  </code></pre>
  <p>create a class  called Advisor that has the following features:</p>
  <p>Attributes:</p>
  <p>message string[5]   //contains five advice messages</p>
  <p>Member functions:</p>
  <p>Advisor()   //default constructor to initialize an array of //strings with</p>
  <p>atleast five advice messages</p>
  <p>getAdvice() //randomly selects an advice from the available //list of</p>
  <p>messages and returns it to the caller of //this method</p>
  <p>Can anybody please help debugging and complete the code</p>
  <p>Thanks in advance</p>