English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Write a method, getSecondLine, that is passed a String argument and that returns the second line. (Recall that lines are terminated with the "\n" character.) Assume that the argument contains at least two complete, newline-terminated lines.


my question is how do I start from the second line?

2006-10-07 06:53:18 · 1 answers · asked by ? 1 in Computers & Internet Programming & Design

1 answers

Something along the lines of:

getSecondLine(String theString){

String[ ] myString = theString.split( "\n" );

System.out.printf( "Second line: %s\n", myString[1] );
}

Should work ;)

2006-10-07 07:13:39 · answer #1 · answered by addtheninth 2 · 1 1

fedest.com, questions and answers