In chapter 1, I learned that java as many similarities to Python, but there are also a lot of differences. For example, both require a semicolon at the end of a sentence, and code blocks are defined by a pair of curly braces { }. For some differencesm if you were to set x equal to a string such as, "Hello!", in Python it would let you do that, but Java requires you to say what kind of variable it is, string x = "Hello!".
I also completed the beer song and found the error. The error is that towards the end of the song, it would print 1 bottles of beer on the wall. You can fix this by moving the if (beersleft==1) and where you set "bottles" equal to word down under the beersleft = beersleft - 1 command.
No comments:
Post a Comment