Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Why is this underlined in red it shouldnt(easy java help)
Why is this underlined in red it shouldnt [message #1182130] Mon, 11 November 2013 21:36 Go to next message
jonathan L is currently offline jonathan L
Messages: 3
Registered: November 2012
Junior Member
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);

}
}
  • Attachment: Untitled.jpg
    (Size: 43.17KB, Downloaded 23 times)
Re: Why is this underlined in red it shouldnt [message #1182259 is a reply to message #1182130] Mon, 11 November 2013 23:38 Go to previous message
David Wegener is currently offline David Wegener
Messages: 1336
Registered: July 2009
Senior Member
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.
Previous Topic:I need help with a code for a game
Next Topic:No project in Clean item?
Goto Forum:
  


Current Time: Fri Aug 22 11:55:00 EDT 2014

Powered by FUDForum. Page generated in 0.01774 seconds