Java Display Multidimensional Array Content

How To Display 2D Array Data Using Java NetBeans

Display Multidimensional Array Vaues Using Java



In this Java Tutorial we will see How To Display Values From A Multidimensional Array Into A jTextArea Using For Loop In Java NetBeans .




Project Source Code:


public void showData(){
        
        String[][] data = {
                             {"A1","B1","C1","D1","E","F","G"},
                             {"A2","B2","C2","D2","E","F","G"},
                             {"A3","B3","C3","D3","E","F","G"},
                             {"A4","B4","C4","D4"},
                             {"A5","B5","C5","D5"},
                             {"A6","B6","C6","D6"},
                             {"A7","B7","C7","D7"},
                          };
        String txt = "";
        for(int i = 0; i < data.length; i++){
            for(int c = 0; c < data[i].length; c++){
                //jTextArea1.setText(jTextArea1.getText() + "");
                txt = txt + data[i][c] + " , ";
            }
            txt = txt + "\n";
        }
        
        jTextArea1.setText(txt);
        
    }
    


OutPut:

Show 2D Array Values Using Java




Share this

Related Posts

Previous
Next Post »

3 comments

comments
18 janvier 2018 à 04:54 delete

Only the sound is not enough or for example text, like some that do not have a sound, to explain, otherwise everything is fine.
Many thanks.

Reply
avatar
18 janvier 2018 à 04:54 delete

Only the sound is not enough or for example text, like some that do not have a sound, to explain, otherwise everything is fine.
Many thanks.

Reply
avatar