I was solving tasks and saw a construction like that:
String t[] = new String[n], e;
Can you help me, what does ", e" mean? Wasn't able to find something about it
CodePudding user response:
This is just a way to declare 2 variables without specifying the type String twice. For example this declares x and y with values 5 and 6:
int x = 5, y = 6;
In your case, t is declared as String array with value assigned as new String[n], and e is a String (no value assigned) so it needs to be assigned before you reference e later.
IMO it is much clearer to specify on separate lines with brackets before the variable name:
String[] t = new String[n];
String e;
Note also that moving [] before t changes the definition of e to String[] such that String [] t = new String[n], e is equivalent to:
String[] t = new String[n];
String[] e;
