title: Access fields of an object passed as a parameter in Java?
body: <p>Is it possible, in Java, to access fields of an object that is passed as a parameter in a method?</p>
  
  <p>Example code:</p>
  
  <pre><code>void myMethod(ArrayList&lt;Integer&gt; list, MyClass object) {   
          Integer myInt = object.x; // x is an Integer-type field in the object
  }
  </code></pre>
  
  <p>I tried the following:
  <code>MyClass curObj = (MyClass)object;</code> to no avail.</p>
  
  <p>Any suggestions?</p>
  
  <p>When I use <code>javac</code> to compile, I get a <code>cannot find symbol</code> error.</p>