Question: As pointed out in Section 8.2.3, the Scanner.next method is a mutator that returns a value. Implement a class Reader that reads from System.in and
As pointed out in Section 8.2.3, the Scanner.next method is a mutator that returns a value. Implement a class Reader that reads from System.in and does not suffer from that shortcoming. Provide methods:

••
public boolean hasMoreElements () // Checks whether there is another element public String getCurrent() // Yields the current element without consuming it public void next() // Consumes the current element
Step by Step Solution
3.39 Rating (152 Votes )
There are 3 Steps involved in it
To implement a class called Reader with the specified behavior we will need to read from Systemin as the Scanner does but well maintain the current el... View full answer
Get step-by-step solutions from verified subject matter experts
