Friday, January 9, 2015

Headfirst Java: Chapter One

Reading chapter 1 of the book, Headfirst Java, has taught me much about the setup and structure of Java programming. Compared to Python, Java is organized much differently. Java is setup in the sequence of Source Files; within those files there are class files, and again within those class files there are Methods, and within methods there are statements.

Python, is very different in the organization. In python there are the Source files, and class files. The difference is in the class files, is that they aren't organized in methods. There are loops, and functions. Loops only active while the code is being read, and functions only activate when typed into the command prompt. Within either loops or functions, there are also statements, however the syntax also tends to be much shorter than Java's.

For example, to get a program to state a string, all you need to do is use the statement: print "Your statement here". In java you have to use the statement: system.out.print "Your statement here." Below is a snip-it of the code I worked on to help get to learn the syntax and structure.




No comments:

Post a Comment