

-----------------------------------

aqazwsx1

Sat Feb 21, 2009 8:03 pm


This won't compile, whats wrong with it

-----------------------------------

This lets the user enter a min and max value, then ask the user too enter a number in the min and max number's range.

    public class Prompter {
   
       public static void main (String 

I got this error :


Prompter.java:8: cannot find symbol
symbol  : variable input
location: class Prompter
      	num1=input.nextInt();
      	     ^
Prompter.java:11: cannot find symbol
symbol  : variable input
location: class Prompter
      	num2=input.nextInt();
      	     ^
Prompter.java:15: cannot find symbol
symbol  : variable input
location: class Prompter
             num=input.nextInt();
                 ^
3 errors

 ----jGRASP wedge2: exit code for process is 1.
 ----jGRASP: operation complete.


Can anyone help? Thanks!


-----------------------------------

btiffin

Sat Feb 21, 2009 8:53 pm


Re: This won't compile, whats wrong with it

-----------------------------------

aqazwsx1;

Google java.io.InputStreamReader and java.util.Scanner for some hints.

Cheers


-----------------------------------

SJ

Sat Feb 21, 2009 9:31 pm


RE:This won\'t compile, whats wrong with it

-----------------------------------

just wondering, is "input" something built into jGRASP?

maybe you'd like to put 

Scanner input = new Scanner(System.in);

at the beginning?


-----------------------------------

mono-1-rulz

Sat Feb 21, 2009 9:37 pm


Re: This won't compile, whats wrong with it

-----------------------------------

First....have you imported the Scanner class from thee java libraries?? 
u hv to import it to use it.....
try typing this at the beginning(even before the class statement):

import java.util.Scanner ; 

Then u should probably create an object called input before using it......use the statement SJ wrote.

Then it should work .   :D


-----------------------------------

aqazwsx1

Sat Feb 21, 2009 11:00 pm


RE:This won\'t compile, whats wrong with it

-----------------------------------

ok thanks everyone! :D

