Wednesday, January 28, 2015

Head First Java Chapter 1

In the first chapter of Head first, I learned a few things.


  • I learned how java is a language that is very nice because it is portable, meaning that you can write it anywhere and run it everywhere.
  • java has an easy syntax that is similar to python, which is a a language that we have previously worked with.
  • All java applications are in terms of classes and objects
  • classes hold all of the methods of your program, and methods are organized by the curly brackets
  •  
 In the chapter we made a program that sang the 99 bottles of beer song, with the code below
This code creates one class, and the variable beer, with a value of 99. The string word changes to bottle if the value of beer is 1, and then prints the song and subtracts the value of beer by one. when the value of beer is 0, it prints that there are no more bottles of beer on the wall.

This program helped me understand the syntax of the java language, how classes and methods work, and how the compiler of java works, as java creates its own virtual machine and runs the code within the machine. We also looked at the phase o matic program, that showed how lists and arrays work, and i learned that they are very similar to python.

No comments:

Post a Comment