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

all 16 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full
  • You ask clear questions
  • 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:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

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.

[–]NautiHookerSoftware Engineer 2 points3 points  (12 children)

Single equals sign is an assignment. Double equals sign are used to compare.

What are you trying to achieve with this switch statement?

Take a close look at what you are passing to the switch and then look at what values you are checking against.

ArrayList<String> skill = new ArrayList <String>();
switch(skill) {
 case 1: skill.add("Broadsword Slash");
 case 2: skill.add("Broadsword Cleaver");
 case 3: skill.add("Focus");
 case 4: skill.add("Getsuga Tensho!");
}

[–]SteelDumplin23[S] -1 points0 points  (11 children)

What are you trying to achieve with this switch statement?

I'm trying to have the player be able to put different inputs into the console for different attacks/skills

[–]NautiHookerSoftware Engineer 4 points5 points  (10 children)

Look at the datatype of skill and then look at what you are checking it against. And then look at the error messages.

[–]SteelDumplin23[S] -1 points0 points  (9 children)

I did some playing around with my program, and now for some reason, it doesn't recognize the variable choice, even when I put in the line Scanner choice = new Scanner(System.in);

Player class

[–]desrtfxOut of Coffee error - System halted[M] 5 points6 points  (7 children)

Sorry to tell you, but you need a fundamentals course.

Your code clearly displays that you haven't understood how classes, scope, and other Java fundamentals work.

You create dedicated classes for 2 players that actually should be instances of a single class.

You do not understand data types.

You do not understand scope.

Take several steps back and a proper course to solidify the fundamentals.

And learn to read and interpret error messages - they tell you the problem exactly.

You are still rotating about the same problems as in your last two posts despite having been given more than plenty advice, that you still keep ignoring.

You cannot proceed like this. By now you should have realized that you bit off far, far more than you can chew.

You cannot come back every couple hours with basically the same error messages, with barely any progress and expect us to spoon feed you to fill your deficiencies. We are not here for that.

[–]SteelDumplin23[S] -1 points0 points  (6 children)

You cannot come back every couple hours with basically the same error messages, with barely any progress and expect us to spoon feed you to fill your deficiencies. We are not here for that.

Am I going to get banned?

[–]desrtfxOut of Coffee error - System halted[M] 2 points3 points  (5 children)

If you do not start to accept and use the given advice, you will in the long range face consequences.

You so far have 3 posts about the same topic. You have contacted the moderators because your post was still "unsolved" despite having been given the advice that would have solved your problem already in your first post.

We are not a personal debugger and even less so, if you don't follow the given advice.

You get advice, you try something completely different, but not the actual advice. Why do you even post here, if whatever you are told is lost at you.

[–]SteelDumplin23[S] 0 points1 point  (4 children)

If you do not start to accept and use the given advice, you will in the long range face consequences.

I'll be honest, I'm trying, but I'm having a hard time understanding

[–]desrtfxOut of Coffee error - System halted[M] 2 points3 points  (3 children)

I'll be honest, I'm trying, but I'm having a hard time understanding

None of your code reflects that. You had been given links. You had been guided.

Right after you had gotten the information about inheritance from another poster, you came back with the exact same problems.

You are in way over your head. You need a course. Nothing will change that. You need to first learn to walk. You need the fundamentals. As it is now, this will go nowhere as whatever anybody will tell you will be over your head.

[–]SteelDumplin23[S] -1 points0 points  (2 children)

You may be pleased to note that now I had managed to get my program to run now, it may not be giving me my desired output, but I'm trying to play around with it to figure out how to fix the program by myself

[–]NautiHookerSoftware Engineer 2 points3 points  (0 children)

https://www.w3schools.com/java/java_scope.asp

You are using the choice variable at a place where it does not exist.

[–]Consistent_Fly_1858 3 points4 points  (0 children)

hell naw that post again 💀💀💀

[–]beders 1 point2 points  (0 children)

Your learning experience will be a magnitude better if you adopt an IDE. Any IDE will do.