title: How to get datas from List<Object> (Java)?
body: <p>I`m new in Java and have a problem with showing data from a list of objects. I have a simple method, which should collect data across multiple tables and return it to my controller: </p>
  
  <pre><code>public List&lt;Object&gt; getHouseInfo(){
  Query q = em.createNativeQuery("SELECT houses.id, addresses.country, addresses.region, house_details.rooms, house_details.square FROM houses, addresses, house_details");
  List&lt;Object&gt; myList = q.getResultList(); 
  return myList;}
  </code></pre>
  
  <p>Now I want to get this data in controller, but I don`t know how to get single results from the list. I tried to do something like this: </p>
  
  <pre><code>List&lt;Object&gt; list = getHouseInfo();
  for (int i=0; i&lt;list.size; i++){
  System.out.println("Element "+i+list.get(0));}
  </code></pre>
  
  <p>but I`m getting only references to this objects (for example [Ljava.lang.Object;@167a47b). I also tried to use Iterator, but the result is the same. I tried to use a code like this: </p>
  
  <pre><code>List&lt;Object&gt; list = getHouseInfo();
  for (int i=0; i&lt;list.size; i++){
  System.out.println("Element "+i+list.get(0)[0]);}
  </code></pre>
  
  <p>but it doesn`t help me too - this ends with a compile error.</p>
  
  <p>Can someone tell me how to get an 'id'(integer value) from this list?
  I`m using MyFaces in my 'View' where I have a code like this (houseControll is the name of my JSF Managed Bean - the controller): </p>
  
  <pre><code>&lt;t:dataList id="myDataList" value="#{houseControll.fullOffer}" var="element" rows="3" &gt;
  ...
  &lt;t:outputText id="houseId" value="#{element[0]}"/&gt;
  ...
  &lt;/t:dataList&gt;
  </code></pre>
  
  <p>this code shows an 'id' value properly - I have 1,2,3,... values. How can I get the same result in my controller? How to print the data in controller?</p>