Scanner stdIN = new Scanner(System.in);
String songs =
" 1. Bob Wow - Fresh Azimiz\n"+
"2. Weezer - Beverly Hills\n"+
"3. Dave Matthews Band - Crash Into me\n"+
"4. Sheryl Crow - Leaving Las Vegas\n";
String songNum;
int songIndex;
int eolIndex;
String song;
System.out.print("Enter song number: ");
songNum = stdIN.nextLine();
eolIndex=songNum.indexOf(songNum);
song=songNum.substring(eolIndex);
System.out.println(song);
No comments:
Post a Comment