This content has been marked as final. Show 3 replies
Not really, its more the territory of books. There is Head First Java which is written to teach through puzzles, games and exercises. Then there is also the official SCJP/OCJP study guide which has a great deal of exercises at the end of each chapter (with the answers in the back of the book). The latter is nice to have if you think about going down the certification route of course, but its quite dry material.
Here is a nice exercise for you I pitch to juniors: create a command line hangman with the following rules and restrictions:
- the game asks for your name and addresses you with it
- possible words you can guess need to be loaded from a text file. You could use this one for example: https://github.com/andypike/hangman/blob/master/dictionary.txt
- a word is randomly chosen, the game does NOT allow the same word to be chosen twice in a row
- you need to be able to play multiple rounds, the game automatically starts a new round each time you win or lose
- the game keeps track of how many times you won and how many times you lost
- you can guess wrong at most 10 times
- the game does not penalize you when you guess a character already guessed before
- the game displays the word to guess , but only all letters you guessed correctly. Letters not guessed yet are displayed as underscores (_).
- if the player inputs more than one character and anything other than a to z, the game simply ignores it and asks for a guess again.
An example: say the word is 'tree'. When the game starts and the user input his/her name it displays this:
Player chooses 'e'.
You have 10 guesses left. Word to guess: _ _ _ _ Guess? : <character will be input here>
Player chooses 'd'.
Correct! You have 10 guesses left. Word to guess: _ _ e e Guess? : <character will be input here>
Player chooses 'e' again.
Wrong! You have 9 guesses left. Word to guess: _ _ e e Guess? : <character will be input here>
etc. etc. If you think this is an easy exercise: you are quite wrong. You have to do File I/O, you'll probably want to use one or more collection classes, you have to figure out randomization, you do several String operations, you do some work with I/O streams and it is a nice introduction into application flow and state management.
Already guessed! You have 9 guesses left. Word to guess: _ _ e e Guess? : <character will be input here>
As previously stated, books are a good way to go. Look for good reviews at amazon.com for any book you are considering. After you read a book on Java and try compiling/running several of its examples on the command line, you can consider downloading Eclipse IDE which is very popular with Java developers. Then I suggest installing a free database such as Oracle Express. Then read up on JDBC and see if you can get your Java program to perform CRUD operations against a database table. Next get a book on JSP/Servlets (assuming you're interested in web application development). I know JSP is getting pretty old and many recommend other things like JSF, but JSP is installed on countless existing applications that you will almost certainly work in future jobs.