Q:

How to take input in Java this way?

I want to take the inputs for the length, breadth and height of my "Box" class repectively. Now I want to take it as a stream of integers and then set them individually to each of the dimension of the box. The stream will be taken as i/p until the user presses 0. So I wrote it this way (I am just mentioning the main method, I defined the box class seperately):
public static void main(String args[])
{

    System.out .print("Enter length, breadth and height->> (Press '0' to end the i/p)");
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    while((br.read())==0)
    {
        // What should I write here to take the input in the required manner?
    }
}

PS: I cannot use scanner, console or DataInputStream. So help me here with BufferedReader.

A:

Since you indicated you absolutely must use the BufferedReader, I believe one way to do this is to use the BufferedReader#readLine() method instead. That will give you the full line as entered by the user, up to the line termination (either a '\r' or '\n' according to the documentation). 
As Zong Zheng Li already said, while the Scanner class can tokenize the input line for you, since you cannot use that, you'll have to do that yourself manually.
At this moment, one way that springs to mind is to simply split on a space (\s) character. So your code might look something like this:
System.out .print("Enter length, breadth and height->> (Press '0' to end the i/p)");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String inputLine = br.readLine(); // get user input

String[] inputParts = inputLine.split("\\s+"); // split by spaces

int width = Integer.parseInt(inputParts[0]);
int height = Integer.parseInt(inputParts[1]);
int breadth = Integer.parseInt(inputParts[2]);

Note that I'm not showing any error or range checking, or input validation, as I'm just showing a general example.
I'm sure there's plenty of other ways to do this, but this is the first idea that popped in my mind. Hope it helps somewhat.

