-1
int n;
Scanner keyboard = new Scanner(System.in);
n = keyboard.nextInt();

My compiler is pointing to the dot in the statement n=keyboard.nextInt(); and providing a "cannot find symbol" error. Any suggestions? Thanks

  • 5
    Did you import `java.util.Scanner`? Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses – MadProgrammer Feb 27 '15 at 21:27

1 Answers1

0

A minimal working example:

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int n;
        Scanner keyboard = new Scanner(System.in);
        n = keyboard.nextInt();
        System.out.println(n);
    }

}

Don't forget to import java.util.scanner.

Jeff Widman
  • 19,508
  • 10
  • 68
  • 84
stivlo
  • 80,386
  • 31
  • 139
  • 197