posted Sep 18, 2013, 8:32 AM by Samuel Konstantinovich   [ updated Sep 18, 2013, 11:39 AM ]
URGENT: Tomorrow is talk like a pirate day. Krispy Kream is offering a free donuts to people that celebrate this holiday. Talk to them like a pirate for 1 free donut. Dress like a pirate for a dozen free donuts. 

  • Compiled Language
    • Human readable source code is translated (compiled) into machine language. (binary)
    • Machine language contains instructions that are run directly by the computer.
  • Source code and machine code are different files.
  • Java is a hybrid of compiled and interpreted language
  • Java programs do not run directly on a computer, they go through the java virtual machine (JVM)
    • The JVM is like an interpreter. It translates from byte code to machine instructions.
  • Source files have a .java extension and are human readable. They _must_ end in .java 
  • Source files are compiled into java byte code by the compiler (javac) and are stored in files which have .class extension.
  • .class files are readable by the JVM
  • All .class files are cross-platform (can be run on any OS that has a JVM)
  • Each platform has a specific JVM. Mac, Windows, Linux, etc.
  • No JVM for Ipods, and Ipads
  1. To Compile (typed in the terminal):
            javac fileName.java
  2. To call the jvm (typed in the terminal):
            java fileName   
  3. In the beginning of a java file, you need:
    public class fileName
    • you don't always have 'public'
  4. In every java program you need a primary function that will be executed. This is called the main:
    public static void main (string [] args){ ... }  //where ... is more stuff
  5. System.out.println() - how to print something to the screen.
  6. If you forget a parenthesis or have a problem similar to that, the file will not compile.  Instead it will show you the error.
  7. Curly braces { } delimit code blocks. 
  8. A semi colon is used to separate statements. This is not necessary when you have code blocks as they are already separated with { } such as a class definition or a method (Notice the main has no semicolon after the closing "}"  )
You Down with OOP?

-Objects have 2 parts to them:
    1. What they have/know, similar to the properties of a turtle, these are called instance variables.
    2. What they can do, which is referred to as the method

-Class is a blue print for all objects of the same type, it refers to the properties of the same objects.

-There will be a different file for every class you make.

-Instance is a specific individual of a given class. 

-To create an instance is to instantiate.

For example:
     Lets say you have a Teacher class- what would you need to put into the class?
        Instance Variables:
        -Interest level
        -Years of experience
        -Subject taught
        -# of classes
        -HW level
        Methods: (things that the teachers do)
        -Yell ()
        -Test ()
        -Teach ()
        -Throw Things ()
        * note: "()" indicates that these are all methods
        Instance of Teacher: (Mr. Konstantinovich)
        - Age: 9001
        - Interest Level: Amazing
        -Years of experience: 9
        -Subject Taught: Komputors
        - # of classes: 5
        - rooms: 451, 251
        - HW level: 5
        -Shape: Human
        -Name: Mr.K