Tuesday, January 13, 2015

HeadFirst Java - Chapter 1




        Chapter 1 of this book call Headfirst Java was very intriguing, reading this book was much better than any other book or textbook that i have read in school. However, it was only chapter 1 and it was kinda just an introduction to Java and since I already have a small background in Java I really did not learn much as it was more of refresher. But on the other hand I was able to troubleshoot the 99 bottles of beer song program and troubleshoot the random phrase generator and make them both successfully run. The code for both are posted below.



99 Bottles of beer program

     The error in this program was that there was a line say " 1 bottles of beer on the wall" and that is very improper grammar. So all I did to fix it was instead of having beerNum > 1, I made it > 0 and it ended up solving the grammatical error. So again this served as a refresher for me for my Java skills, but since then I have learned Python. Python syntax is like Java in many ways but is less complex. I have found that I am almost writing Python syntax when writing the code above. I have high hopes for this Java book to teach me more about Java and take me more in depth about it.


Random Phrase Generator


This is the code for my random phrase generator. I did this for some extra work and to see what I could do and how much I could remember and do on my own. It actually ran on my first time and did what I wanted to do. Unlike when I did Python I would have to go through each time and fix my code several times before it would run. I was able to generate random phrase from my words list just like I wanted to do. When finishing a good piece of code and then seeing it actually work it gives you a since of accomplishment and just makes you feel good about yourself. All in all chapter 1 for Headfirst Java was very successful in refreshing my memory and getting me back on track to learn more Java.

No comments:

Post a Comment