How to realize Table data Storage in Java
This article mainly shows you "how to achieve table data storage in Java", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to achieve table data storage in Java" this article.
One-dimensional and two-dimensional array to realize the storage of table data import java.util.Arrays / * * use Object [] [] to store table information * @ author Lhk * * / public class Array_Test01 {public static void main (String args []) {/ / an Object [] array represents a row of data of the table / / the basic data types here are 1001m 1002m 1003 essentially not Object objects Java compilation automatically "boxed" the basic data types into wrapper class objects Object [] emp0= {1001, "Mingming", 20, "programmers", "2021-03-28"} Object [] emp1= {1002, "Hua Hua", 21, "programmer", "2021-02-28"}; Object [] emp2= {1002, "Xiao Li", 19, "programmer", "2021-04-01"}; Object [] [] emps=new Object [3] []; emps [0] = emp0; emps [1] = emp1; emps [2] = emp2; / / traversal array (you can use a nested loop to traverse a multidimensional array), output table for (int item0faci)