String s2 = "Our greatest glory is not in never falling, but in rising every time we fall.";
String[] split1 = s2.split(" ");
for (String s3 : split1) { System.out.println(s3 );
}
CodePudding user response:
This is the implementatio:
String s2 = "Our greatest glory is not in never falling, but in rising every time we fall.";
String[] split1 = s2.split(" ");
for (int i = 0; i < split1.length; i ) {
for (int j = 0; j < i 1; j ) {
System.out.print(split1[j] " ");
}
System.out.println();
}
Output:
Our
Our greatest
Our greatest glory
Our greatest glory is
Our greatest glory is not
Our greatest glory is not in
Our greatest glory is not in never
Our greatest glory is not in never falling,
Our greatest glory is not in never falling, but
Our greatest glory is not in never falling, but in
Our greatest glory is not in never falling, but in rising
Our greatest glory is not in never falling, but in rising every
Our greatest glory is not in never falling, but in rising every time
Our greatest glory is not in never falling, but in rising every time we
Our greatest glory is not in never falling, but in rising every time we fall.