Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to create a sublist in java

// Create a list of Strings with [2] rows, and [5] columns
String[][] listOfStrings = new String[2][5];
// Create a list of integers with [1] row, and [2] columns
int[][] listOfInts = new int[1][2];


// How you add stuff to the list (Do inside a method in your class)
listOfStrings[0][0] = "The"; // Will fill index 0 of the nested list at index 0 
listOfStrings[0][1] = "Cake";
listOfStrings[0][2] = "is";
listOfStrings[0][3] = "a";
listOfStrings[0][4] = "lie";
 
PREVIOUS NEXT
Tagged: #create #sublist #java
ADD COMMENT
Topic
Name
7+6 =