Recitation 1: Intro java Part 0: Eclipse and Java setup - Go to www.eclipse.org/downloads and download "Eclipse IDE for Java Developers" - Go to http://www.oracle.com/technetwork/java/javase/downloads/index.html and download "Java Platform (JDK) 7u2" - Install Java - Unzip Eclipse - Set-up java for command line user (optional) • Windows (vista/7) > control panel -> system -> advanced system settings > select the "Advanced" tab > click on the button at the bottom called "Environment Variables..." > under "System Variables" click "New..." > name the variable "JAVA_HOME" and set the value to the absolute path where java in installed > click ok > under "System Variables" look for a variable named "Path" if it does not exist make create it. > edit the value in the path variable. BE SURE NOT TO CHANGE WHAT IS ALREADY THERE. At the very end of the current value add ";%JAVA_HOME%\bin" (no quotes) > click ok > click ok again to exit the Environment Variables window > click ok again to exit the System Properties > Open a command prompt > enter "java -version" (no quotes) > you should see the version of java that has been installed. • Mac/linux > using the editor of your choice edit your .bashrc file > append the following to your .bashrc file export JAVA_HOME=/path/to/java export PATH=$PATH:$JAVA_HOME/bin > make sure to replace /path/to/java with the actual path to java. > open terminal > type "java -version" (no quotes) > you should see the veresion of java that has been installed Part 1: From c to java - primitives • java does not have unsigned numbers • strings vs char* > strings are objects not just an array of chars - No pointer arithmetic • no memory management - garbage collector - array basics • array of 3 integers > int[] arr = new int[3] Part 2: java keywords - new • used to create objects - public • visible to everyone - private • visible to no one - protected • visible to package and is inherited (to be discussed later) - class • defines a class • classes can be public or private - static • shared across objects • static methods can be called without an object • related to a class rather than an object Part 3: code - Hello world example • the main method > public static void main(string[] args) • basic system io > System.out.println • string manipulation > what is "5" + 2 > what is 2 + "3" - Basic Interface and substitutivity example • constructors