Salar
Salar

Reputation: 269

Java error cannot find symbol class Scanner.using jdk 6

import java.util.scanner;

import javax.swing.JOptionPane;

public class FirstHomeJavaApplet{

public static void main(String[] args){

int num1=2;

int num2=2;

int sum;

sum=num1+num2;

System.out.println("My first home practice of java applet"); 

 JOptionPane.showMessageDialog(null, num1 + "+" + num2 + " = " + sum, "Result of Addition", 

JOptionPane.INFORMATION_MESSAGE);

}

}

This is my code but it is giving 1 error.I am using jdk 6 to run this applet.

The error is :cannot find symbol

symbol:class scanner

location:package java.util

import.java.util.scanner;

               ^

Thanks..

Upvotes: 0

Views: 5009

Answers (5)

Thilo
Thilo

Reputation: 262534

The class is called java.util.Scanner (with a capital S).

Upvotes: 0

rics
rics

Reputation: 5596

Because the class name is Scanner not scanner.

Upvotes: 0

sushil bharwani
sushil bharwani

Reputation: 30187

See that your class name starts with a Capital letter java.util.Scanner; instead of java.util.scanner;

Upvotes: 0

Matthew Flaschen
Matthew Flaschen

Reputation: 284836

By convention, Java classes start with capital letters. So it should be Scanner throughout. E.g.

import java.util.Scanner;

Upvotes: 0

Fredrick Pennachi
Fredrick Pennachi

Reputation: 842

Scanner should start with a capital S :)

Upvotes: 2

Related Questions