5 pts.
 help me on use input data JAVA
Hello friends I encountered a problem i,e
import java.io.*;
public class execute {
public static void main(String args[])throws Exception{
char cname;
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter a letter");
cname= (char)br.read();
if(cname==' '){
System.out.println("u entered a space");
}
else {
System.out.println("u entered a character");
}
}
}
In the above program, help in writing a loop such that
until and unless a character is entered(as input from keyboard) ,it should keep asking me to "Enter a character"


Software/Hardware used:
eclipse
ASKED: March 18, 2010  4:04 AM
UPDATED: November 5, 2011  4:27 PM

Answer Wiki:
lets keep the code in the try block if the input is any space u keep it in that and catch in catch block or in finally block u keep the loop.It might solve ur problem
Last Wiki Answer Submitted:  November 5, 2011  4:27 pm  by  shiva3322   660 pts.
All Answer Wiki Contributors:  shiva3322   660 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

lets keep the code in the try block if the input is any space u keep it in that and catch in catch block or in finally block u keep the loop.It might solve ur problem

 660 pts.