This is my code need help .the online judge tells me it's a compilation error . I've tried many sample input !
another Question is the problem asks me to ensure that the sentence contains only letters + white spaces ??? Thanks in advance
package poetry;
import java.io.*;
public class Poetry {
public static void main (String[] args) throws IOException {
String sentence ;
String [] tokens ;
InputStreamReader input = new InputStreamReader (System.in);
BufferedReader reader = new BufferedReader (input);
sentence = reader.readLine () ;
while (! (sentence.equals("*"))) {
tokens = sentence.split (" ") ;
int t ;
char temp = tokens[0].charAt(0);
char sec ;
if (Character.isLowerCase(temp) ) {
sec = Character.toUpperCase (temp) ; }
else
{ sec = Character.toLowerCase (temp) ;}
for ( t = 1 ; t <tokens.length ; t++ ){
if (tokens[t].charAt(0) == temp || tokens[t].charAt(0) == sec ){ continue ;}
else { break ;}
}//end for loop
if (t == tokens.length ) {System.out.println("Y") ;}
else {System.out.println("N") ;}
sentence = reader.readLine () ;
}//end while
}
}