Results 1 to 5 of 5
  1. #1
    Sanna.1 is offline Member
    Join Date
    Feb 2012
    Posts
    5
    Rep Power
    0

    Default problem whit the scanner

    PHP Code:
    class bool   
    {
        public static void main(String args[])  
    	 {
            int var1 = 0;
    		  int var2 = 0;
    		  int var3 = 0;
    		  
    		  Scanner scan = new Scanner(System.in);
    
                      boolean sv1 = (var1 % 7 == 0);
    		  boolean sv3 = ((var1 > var2) || (var1 > var3));
    		  boolean sv4 = (var1 > var2 && var1 > var3);
    		  boolean sv5 = ((var1 > var2 || var1 > var3) && (var1 < var2 || var1 < var3));
    		  
    		  System.out.print("tal1: ");
    		  var1=Integer.parseInt(scan.next());
    		  
    		  System.out.print("tal2: ");
    		  var2=Integer.parseInt(scan.next());
    		  
    		  System.out.print("tal3: ");
    		  var3=Integer.parseInt(scan.next());
    		  
                      System.out.println("\n sv1 = " + sv1);
    		  System.out.println("\n sv3 = " + sv3);
    		  System.out.println("\n sv4 = " + sv4);
    		  System.out.println("\n sv5 = " + sv5);
        }
    }
    I get 2 error like this.
    error: cannot find symbol
    Scanner scan = new scanner(System.in);
    ^
    symbol: class scanner
    location: class bool

    cannot find symbol
    scanner scan = new scanner(System.in);
    ^
    symbol: class scanner
    location: class bool

    and wondering if tal3 is not evenly divisible by the number tal2. how do you do it. If it is divisible you put % in to it that i know

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,042
    Rep Power
    20

    Default Re: problem whit the scanner

    Java is case sensitive (Scanner, not scanner).
    And you need to import Scanner at the top of your class.

  3. #3
    Sanna.1 is offline Member
    Join Date
    Feb 2012
    Posts
    5
    Rep Power
    0

    Default Re: problem whit the scanner

    i have change it and it still say the same thing about the S

  4. #4
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,042
    Rep Power
    20

    Default Re: problem whit the scanner

    Have you imported Scanner?
    If so you'll have to repost the code and the errors, because I doubt you've done exactly what I suggested.

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,516
    Rep Power
    25

    Default Re: problem whit the scanner

    Also you need to execute the code that sets the boolean variables values AFTER you give values to the var variables.

Similar Threads

  1. Problems whit reading file from InputStream
    By nicox1984 in forum New To Java
    Replies: 1
    Last Post: 12-17-2011, 12:44 PM
  2. Problem with the Scanner
    By Maretaga in forum New To Java
    Replies: 6
    Last Post: 07-14-2011, 09:14 AM
  3. Scanner problem.
    By keo in forum New To Java
    Replies: 6
    Last Post: 04-07-2011, 08:30 AM
  4. Scanner problem
    By mkay in forum New To Java
    Replies: 2
    Last Post: 10-28-2010, 12:09 AM
  5. Problem with scanner
    By Kangaroo128 in forum New To Java
    Replies: 11
    Last Post: 09-01-2009, 08:07 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •