Skip to main content


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] Tue, 12 November 2013 02:36 Go to next message
jonathan L is currently offline jonathan LFriend
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 319 times)
Re: Why is this underlined in red it shouldnt [message #1182259 is a reply to message #1182130] Tue, 12 November 2013 04:38 Go to previous message
David Wegener is currently offline David WegenerFriend
Messages: 1445
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: Thu Apr 25 14:19:31 GMT 2024

Powered by FUDForum. Page generated in 0.07968 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top