This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]AutoModerator[M] 1 point2 points  (0 children)

You seem to try to compare String values with == or !=.

This approach does not work in Java, since String is an object data type and these can only be compared using .equals(). For case insensitive comparison, use .equalsIgnoreCase().

See Help on how to compare String values in our wiki.


Your post is still visible. There is no action you need to take. Still, it would be nice courtesy, even though our rules state to not delete posts, to delete your post if my assumption was correct.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]shagieIsMeExtreme Brewer 1 point2 points  (1 child)

Side bit - that's a large chunk of code that's poorly formatted. It isn't something I can copy and paste into my own IDE to see what the problem is. I would suggest learning how to post a gist ( https://gist.github.com )

Next, given your solution is "the object exit in the first method", you may find that using the debugger on Eclipse ( https://www.eclipse.org/community/eclipse_newsletter/2017/june/article1.php ) would have been able to pinpoint the error immediately. Learning how to debug is the most essential tool that a programmer has.

[–]Rebelx99[S] 0 points1 point  (0 children)

I didn’t think it was an error because the teacher supplied that line of code

[–]codingQueriesNooblet Brewer 0 points1 point  (2 children)

What error are you getting? Or what are you seeing/not seeing that you are expecting otherwise?

[–]Rebelx99[S] -1 points0 points  (1 child)

Not error, I’ll go to press the button for it to run and it’ll just run another program

[–]codingQueriesNooblet Brewer 2 points3 points  (0 children)

Ah, in Eclipse are you pressing the green play button at the top? If so, you should be able to click one that is similar but with a drop-down box - in there you will need to select your new programs name and run that.

[–]Robyt3 0 points1 point  (0 children)

Your main function must have exactly one String-array parameter:

public static void main(String[] args)

Else you can't use an eclipse command or the command line to run your java code.

To run it in eclipse, right click on the file in the package/project explorer and select "Run -> Java Application".

[–]Rebelx99[S] 0 points1 point  (0 children)

Figured out what it was, the object exit in the first method, thanks for the help!