I/O streams: keyboard input
hello everybody!
i've a small problem here. in this program, a series of string inputs has to be taken from user through keyboard, the no of inputs is based on test cases, i.e., if user enters 3 test cases then he has to enter 3 string inputs, the string inputs are 2 be stored in an array, i dont know what iz the problem with this program, iz there n.e 1 who can point out and correct my mistake(s)
import java.io.*;
class InputTest
{
public static void main(String args[]) throws IOException
{
int testCases;
String inputs[];
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
testCases=Integer.parseInt(br.readLine());
System.out.println("test cases="+testCases+"\n");
for(int i=0;i<testCases;i++)
{
inputs[i]=br.readLine();
System.out.println("input="+inputs[i+1]+"\n");
}
}
}
plz reply as soon as possible bcoz this is my class assignment :-(
i'll w8 4 a good reply
|