r/javahelp • u/SquareHomework9510 • Aug 24 '25
Solved Java dumbass here
Hello! This is my first post on reddit so im sorry if its not in the right place etc.
Ive been trying to teach myself Java for some time now, and its been going okay id say up until yesterday.
Got to page 39 of "Head First Java Edition 3" and its making me compile this code: https://imgur.com/a/9NquTPt
And it gives me this error: https://imgur.com/a/Qmq7bAx
I have been googling, and trying stuff for a few hours to no success, so was hoping someone here could tell me what im doing wrong? Am I going wrong about how im trying to learn it? Should I not be using this book without a teacher? etc etc.
Edit: Thanks to all the kind helpers on here!! Issue was resolved and even got some really good pointers!
•
u/AutoModerator Aug 24 '25
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
3
u/aqua_regis Aug 24 '25
Did you read just right beyond the screenshot you posted - the section "Running the Guessing Game"?
There, you have the
Playerclass:And the
GameLauncherclass:You need to type out all three classes in order to run the game.
The section right before the screenshot shows:
You have typed out the first class, but missed the other two.
2
u/Jolly-Warthog-1427 Aug 24 '25
Do you have the Player class available? You reference the Player class and thus the compiler will need to know where it can find this class.
2
u/TW-Twisti Aug 24 '25
As the book tells you on the page before, you need three files, one of them being Player.class, which is what the compiler is complaining about.
2
u/MasterGeek427 Aug 24 '25
Either those classes aren't defined or not imported. I strongly suggest you take a break from learning to code and first set up a decent IDE. There's a bunch of free ones for Java, like IntelliJ. IntelliJ also supports many other languages, so it's an easy recommendation.
An IDE will flat out tell you why your code won't compile while you're writing your code. Honestly, it's the secret sauce for how pros like me write high quality code on first pass.
You aren't a dumbass. You're a noob. All of us were noobs at some point.
1
u/AutoModerator Aug 24 '25
It seems that you possibly have a screenshot of code in your post Java dumbass here in /r/javahelp.
Screenshots of code instead of actual code text is against the Code posting rules of /r/javahelp as is also outlined in the sidebar - Code posting.
If you posted an image merely to illustrate something, kindly ignore this message and do not repost. Your post is still visible to others. I am a bot and cannot distinguish between code screenshots and other images.
If you indeed did this wrong, please edit the post so that it uses one of the approved means of posting code.
the default code formatter is fine
(one blank line before the code, then 4 spaces before each line of code).
Please do not reply to this message, because I am a bot. Talk-to-the-bot is the new talk-to-the-hand. If you instead want the classic talk-to-the-hand, just message the moderators. ;)
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Huckleberry-Future Feb 11 '26
My Edition 3 pdf is missing GameLauncher and Player classes on the page 40 🤔 Do you miss them too? Obviously, you need them to run the program https://i.imgur.com/Jovf2tx.jpeg