Search:

Type: Posts; User: hope_08

Search: Search took 0.15 seconds.

  1. Replies
    6
    Views
    8,987

    [SOLVED] Re: Scanner closed error

    hi

    have appended the wid your code below

    public class capital
    {public static void main(String[] args) throws FileNotFoundException
    {
    // ask the user for...
  2. Replies
    6
    Views
    8,987

    [SOLVED] Re: Scanner closed error

    Hi

    You can define a counter variable "found" before the while loop as int found = 0;
    increment it i.e found++ in the if condition.
    and outside the while loop put the below condition
    if...
  3. Replies
    6
    Views
    8,987

    [SOLVED] Re: Scanner closed error

    Hi

    You need to put the statement countryInput.close(); i.e close the scanner after the while loop.
    And for displaying the message define a variable found before the while loop as int found = 0;...
Results 1 to 3 of 3