|
Re: Why is this underlined in red it shouldnt [message #1182259 is a reply to message #1182130] |
Mon, 11 November 2013 23:38  |
Eclipse User |
|
|
|
On 11/11/2013 8:36 PM, jonathan L wrote:
> i uploaded a image with code. the inpt thats between # # is underlined but if i change it to ( HI ) thats the name of the scanner is fixed can some one explain why this is.
> theres no # # in the real code
> import java.util.Scanner;
>
> public class Main {
>
> public static void main(String arg[]) {
>
> Scanner hi = new Scanner(System.in);
>
> System.out.println("Please enter how much you would like to deposit ");
>
> int money = #input#.nextInt();
>
> System.out.println("you deposited $" + money);
>
> }
> }
>
The underlining is correct. The variable input is undefined in your
program. Since it is undefined, the compiler has no way to know what it
is. Changing it to HI won't fix it either. You have to change it to
hi. Java is a case sensitive language. HI is undefined, hi is defined.
If you hover over the underlined input, you will get a popup indicating
the error. This will help you figure out these errors on your own
without having to wait for a response on a mailing list.
|
|
|
Powered by
FUDForum. Page generated in 0.11251 seconds