title: How to convert a JAVA object into an HTML table?
body: <p>I want a generic way to convert Java object to HTML table that contains the member variables of this object as the column name and the value of this member as a value in the table like this:</p>
  
  <pre><code>class Person {
  
      public String _name;
      public int _age;
  
      public Person(){
          this._name = "John Doe";
          this._age = 2;
      }
  };
  </code></pre>
  
  <p>If the object of type person I want the output to be something like this.</p>
  
  <pre><code>---------------------------
  |    _name   | _age        |
  ---------------------------
  
  |    John Doe | 2          |
  ---------------------------
  </code></pre>
  
  <p>The problem is I don't have access to the classes code.</p>
  
  <p>Is there a generic way to implement a function that can take a Java object of any type and print the member variable and its value?</p>
  
  <p>I thought about using <code>toString()</code> but it didn't help since I can't override it in my case.</p>
  
  <p>If this is the class</p>
  
  <pre><code>class Person {
  
      public String _name;
      public int _age;
  
      public Person(){
          this._name = "John Doe";
          this._age = 2;
      }
  };
  </code></pre>
  
  <p>then <code>PrintobjectToHTML();</code> output is supposed to be</p>
  
  <pre><code>---------------------------
  |    _name   | _age        |
  ---------------------------
  |    John Doe |    2       |
  ---------------------------
  </code></pre>