title: how can I put array inside class
body: <p>I'm trying to put array inside class</p>
  
  <pre><code>ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;();
  
                  item_messages.add(new Item_Messages(response.getJSONArray("posts").getJSONObject(x).getString("id"),response.getJSONArray("posts").getJSONObject(x).getString("userid"),response.getJSONArray("posts").getJSONObject(x).getString("authorname"),response.getJSONArray("posts").getJSONObject(x).getString("message"),String.valueOf(response.getJSONArray("posts").getJSONObject(x).getJSONArray("Likes").length()),response.getJSONArray("posts").getJSONObject(x).getString("type"),list.get(0)));
  </code></pre>
  
  <p>but there is a problem</p>
  
  <p><a href="https://i.stack.imgur.com/kJyhp.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>my class</p>
  
  <pre><code>package com.salah.mymessages.whatsapp;
  
  
  import java.util.ArrayList;
  
  public class Item_Messages {
  
  
      String id,userid,authorname,message,likes,type;
      ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;();
  
      public Item_Messages(String id, String userid, String authorname, String message, String likes, String type, ArrayList&lt;String&gt; list) {
          this.id = id;
          this.userid = userid;
          this.authorname = authorname;
          this.message = message;
          this.likes = likes;
          this.type = type;
          this.list = list;
      }
  }
  </code></pre>
  
  <p>hope you help me</p>