Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: "Can not find symbol" when I use int and scanner

  1. #1
    Junior Member
    Join Date
    Jul 2019
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default "Can not find symbol" when I use int and scanner

    package javaapplication1;
     
    import java.util.Scanner;
     
     
     
     
    public class Scan {
     
        public static void main(String args[])
        {
            Scanner scan = new Scanner(System.in);
     
            int = a, b;
     
            System.out.print("A = ");
            a = scan.nextInt();
     
            System.out.print("B = ");
            b = scan.nextInt();
     
            System.out.print(a + " + " + b + " = " + (a + b));
     
        } 
     
     
     
    }

    When programme works, I want describe the "A" and "B", and programme should give me result of "A+B" but It says "Can not find symbol" at "int = a, b;" 's next to.
    ...
    Sorry for my bad English : D
    Attached Images Attached Images

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: "Can not find symbol" when I use int and scanner

    Can you copy the full text of the error message and paste it here so we can see what symbol the compiler can not find a declaration for?

    The text in the posted image is too small to read.

     int = a, b;
    There should not be an = sign when trying to declare variables.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    Sincanner (July 11th, 2019)

Similar Threads

  1. Replies: 9
    Last Post: November 19th, 2013, 04:45 PM
  2. "Error cannot find symbol" "throws BadLocationException"
    By coltson in forum AWT / Java Swing
    Replies: 1
    Last Post: June 30th, 2013, 10:33 PM
  3. "cannot find symbol" error when trying to use the getInt() method.
    By simpson_121919 in forum Collections and Generics
    Replies: 6
    Last Post: February 21st, 2013, 12:48 PM
  4. Replies: 3
    Last Post: January 22nd, 2013, 07:14 AM
  5. "Cannot find symbol" compilation error
    By collegejavastudent in forum What's Wrong With My Code?
    Replies: 7
    Last Post: December 12th, 2011, 05:07 PM

Tags for this Thread