Hi. I'm extremely new to java because it is a required module (and I have little to no programming experience). I want to point out that this is for a graded assignment, but I am unable to sit down and figure out what's going wrong. For some context, we are asked to create a method that checks whether a target is north or south of a robot's starting position. There is also a PDF that guides us along the way. The first attached image is a screenshot of the guide PDF, showing us what the method's structure should generally look like. The second image is what I have written for the method with some other things below it (pertaining to previous exercises about how the robot should actually choose its directions). And the third image are the errors that I receive when I try to compile the code. The first error is the one that is catching me off guard that 'private' is an illegal start of the expression and I am not sure why. Should I be placing this method somewhere else in the code? Any help would be greatly appreciated!
#Multiple errors pour out. (complete noob beginner at java)
11 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @violet mural! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Is the method within another method
private can only be used in the body of a class
Oh there was another image @violet mural
you can't nest a method like that
you would have to use a lambda expression to achieve that functionality
although it may just be easier to nest the method directly in the class
Oh okay. That has worked brilliantly. Thank you so much!
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.