public class FileReaderUpdate { static String m [][] = new String [2][3]; static Scanner sc; public static void main (String [] argv) { openfile(); readfile(); out(); } } ...... 

How to fix " static String m [][] = new String [2][3]; " so that it is borderless, so that it calculates how many lines and how long the string is.

    1 answer 1

    use ArrayList

     List<List<String>> mainList; mainList = new ArrayList<>; List sublist = new ArrayList<>; sublist.add("Привет"); mainList.add(sublist); 

    get the size of the mainList.size() array

    • I have a text file, I need to output this all through an array to the console. - Satanist Devilov
    • 1. Cannot output without an array? could the characters do this 2. if the array is, then only a primitive type can be used? Since the List also works as an array - Saidolim