I am trying to read data from mysql form a specific table call Menu this table contain four rows I just need to read 4 rows only like item name, price, type, category as to Print it in console in a form of String Like a table view
I tried to create a method do this but I failed, like this method
public static void getMenuItems(String tableName) {
    try {
        setConnection();
        Statement stmt = con.createStatement();
        ResultSet rs;
        String strSelect = "select from " + tableName;
        rs = stmt.executeQuery(strSelect);
        // make the selection at the last row
        rs.last();
        int c = rs.getRow();
        rs.beforeFirst();
        String values[] = new String[c];
        while (rs.next()) {
            int i = 0;
            values[i] = rs.getString(1);
            i++;
        }
        con.close();
        System.out.println(values);
    } catch (SQLException e) {
        Tools.msgBox(e.getMessage());
    }
and this is my Menu.Class
public class Menu implements mainData{
    private int Menu_Id;
    private String Name;
    private float Price;
    private String Type;
    private String Category;
    public int getMenu_Id() {
        return Menu_Id;
    }
    public void setMenu_Id(int Menu_Id) {
        this.Menu_Id = Menu_Id;
    }
    public String getName() {
        return Name;
    }
    public void setName(String Name) {
        this.Name = Name;
    }
    public float getPrice() {
        return Price;
    }
    public void setPrice(float Price) {
        this.Price = Price;
    }
    public String getType() {
        return Type;
    }
    public void setType(String Type) {
        this.Type = Type;
    }
    public String getCategory() {
        return Category;
    }
    public void setCategory(String Category) {
        this.Category = Category;
    }
           //have here some method
.....................................
//Here is a method called getCustomRows
    @Override
    public void getCustomRows(String statement, JTable table) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
}
 
     
    