Thursday, 3 October 2013

I don't know how to use a fuction of the Scanner classs

I don't know how to use a fuction of the Scanner classs

so I have to do a Flask Machine assignment and I have a small problem with
the scanner class. I created a method in which I want to add the bottle
types(A B or C) to an arraylist. So I don't really know how many bottles I
will enter. The thing is I want my scanning to stop once I encounter a
,,0". I know I have to use a while loop but using it like this doesn't
work because by the time I want to add the bottle to the list, it jumps to
the next scanned bottle.
While(input.next()!="0"){
list.add(input.next());
count++;
}

No comments:

Post a Comment