title: Can I access a classes constructor variables the someway as in JS?
body: <p>Is it possible to access the variables of a object the same way you can in JS.</p>
  
  <p>For example:</p>
  
  <pre><code>import java.util.*;
  class Dice{
      public String [] side;
      public String name;
  
      public Dice (String n, String ... a){
          name = n;
          side = a;
  
      }
  
      //Setter and Getter side
      public String getSide(){
          return side;
      }
      public void setSide(String s){
          side = n;
      }
  
  }
  </code></pre>
  
  <p>The array is initialized in main like so:</p>
  
  <p><code>Dice easy = new Dice("Green:","Brain","Brain","Brain","Foot Print","Foot Print","Shotgun");</code></p>
  
  <p>It has a name "Green".</p>
  
  <p>The rest of the objects Strings are stored inside a String array.</p>
  
  <p>To access the array in JS you can:</p>
  
  <p><code>Dice.side[1];</code></p>
  
  <p>Can we access them in Java like this, I am trying to access the array in main()?</p>
  
  <p><code>String theStringInArray = Dice.side[1];</code></p>
  
  <p><code>System.out.println(theStringInArray);</code></p>
  
  <p>The result should print "Brain" in this example.</p>
  
  <p>(This is only for myself and to gain practice I have been reading about ArrayLists but only using arrays in this example :) </p>