I am taking a command line input string like this:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine();
I want to split this string which is:
String line = "int t; //variable t
t->a = 0; //t->a does something
return 0;"
like this:
String[] arr = line.split("\n");
arr[0] = "int t; //variable t";
arr[1] = "t->a=0; //t->a does something";
arr[2] = "return 0";
but when i run my java program that split function only returns this:
arr[0] = "int t; //variable t";
it didn't returns other two strings that i mentioned above,why this is happening please explain.