-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
  • 22,014
  • 12
  • 72
  • 88
stivlo
  • 83,644
  • 31
  • 142
  • 199