Hi,
Try this:
public class Main {
public static void main(String[] args) {
String initialString = "line1\nline2\nline3";
System.out.println(initialString);
System.out.println();
String[] eachString = initialString.split("\n");
for(int i = 0; i < eachString.length; i++) {
System.out.println("My line " + i + ": " + eachString[i]);
}
}
}
[UPDATE]
String InputInstArray[] = new String[100];
BufferedReader InstStorageBuf= new BufferedReader(new InputStreamReader(System.in));
for(int getlnst=0; getlnst<100; getlnst++) {
InputInstArray[getlnst] = InstStorageBuf.readLine();
if(InputInstArray[getlnst].isEmpty()) {
break;
}
}
What I'm supposing what do you want is that you want to read data from command line and when the user wants not insert more data, stop the loop.
Best Regards,
Filipe