Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Objects (Retired) Creating the MVP Remaining Tries

What is the idea/purpose of the Hangman track?

Hi guys,

Maybe it's a strange title for a question, but I couldn't think of anything better.

I just started learning Java and it's getting quite hard now (I'm about to finish the 'Creating the MVP' - well, I hope I am - ).

The thing is, it's getting really tough. I have to watch every video multiple times to really understand what Craig is doing. I make a lot of notes and I try to complete every challenge without going through the notes or rewatching the video. And I continue only if I really understand the challenge. But especially this Hangman course is really tough and I couldn't complete the last challenge.

For example: The 'For each loop' challenge.

I'm able to understand what I have to do. Whenever I have to do a challenge I write down what I think needs to be done. So now I had the following:

  1. We need to take the mHand (for example "ABBBH")
  2. We need to convert the mHand to an array with all the chars ('A','B','B','B' and 'H')
  3. We need to check whether 'A' is part of "ABBBH", if so add 1 to a counter. We need to check whether 'B' is part of "ABBBH", if so add 1 to a counter .. (so we need to loop that one).
  4. We need to return the counter.

And often I'm able to 'convert' these steps to code. I know I have to use the .toCharArray and use == . But when it comes to writing out the complete code, I'm too often stuck, or I make mistakes or forget import stuff. I lack the basics of Java in a way.

So my question: Am I supposed to understand and be able to use everything during these tracks? Or is it enough to just understand what Craig is doing for now, and later on I'll be able to write it faster without less errors or with a better understanding? Because I kind of feel I'm in way over my head with these tracks.

Anyway, I hope you understand what I'm trying to say,

Thanks,

Bart van Ackooij

3 Answers

Kevin Faust
Kevin Faust
15,353 Points

Hey Bart,

Just to make you feel assured, you do NOT have to understand every single thing. Just understand what is going on and get yourself familiar with the code. I started java around a month ago with just some prior html/css/javascript experience. I felt the exact same way as I progressed through this track. Things were getting way too hard, I couldn't understand what was going on, and challenges could take me over an hour or several days to figure out. I really was just blindly copying what Craig wrote on his screen onto mine. And then at the end of the video, I would try to understand what we did. Usually I didnt understand much but what I did do was ask questions on the forums on nearly every single video. That way I could digest someone else's explanation of the topic. However sometimes I was lost on the entire video and I didnt even know what I didnt know (if that makes sense)

As well, what I tended to do was before watching a video, I would scroll through the questions in the video and see what problems others had and then read the solutions to them. Usually it didn't really make much sense but I still did it and tried to break it down and get familiar with some terms. It also just makes you feel a bit better when you see that your not the only one that is having difficulties.

I wanted to quit countless times...probably every single day I did java to be honest. A 10 minute video could take me 2 hours to understand. However I kept at it and now looking back at all the challenges, I can do the majority with no problem although some might take a long time. Im nearing the end of the track and I am comfortable with the majority of the topics covered on this track. As you said, you are already watching the video multiple times which is great. Making notes is also great. Make sure you understand a good chunk of what's going on before moving on. I was never a person to go on google and search for more extra information but if there's a topic or term your not sure about, make sure to find out what it is.

Although the explanations can be not good at times and information online can be pretty bad, just keep at it and redo past challenges often. If you have any specific questions on a video or a challenge, others and myself would be happy to help!

Also by the wording of your for-each loop question, you've got the breakdown of the challenge down but I'm not sure if you completed it or not. ive added the solution below with a few notes just in case

If this helped, don't forget to mark as best answer :)

Best of luck and happy coding,

Kevin

public int getTileCount(char tile) { 
    int count= 0; //initialize the count variable at 0
    for (char specificTile : mHand.toCharArray()) { //loop through the chars of our mHand 
      if (specificTile == tile) { //if the tile we are looping through is equal to the one we passed in...
        count++; /...then increase the count by 1. keep doing this until we loop through the entire mHand char array
      }
    }
    return count; //return the value of our count variable after the looping
  }

Hey Kevin,

Thank you for your reply. It is reassuring I'm not the only one who spends a few days on tracks where it says '41 minutes left' haha.

I still feel that the courses/tracks could you use a chapter where the basics of Java are explained thoroughly. But maybe the idea is for the users to try to gain this information on their own so it will stick better in the long run.

Anyway, thanks for your reply! I'll continue the tracks and I will complete the Java track!

Bart

How long did it take for you guys to understand. I've been doing this course for about 2 weeks and this section is so confusing. I keep wanting to quit ;_;

Kevin Faust
Kevin Faust
15,353 Points

depends how long you spend a day

Don't give up! It took a while and some extra tutorials online. But at some point it'll make sense. Just keep going!