Computer Science 15-100 (APEA Section E), Summer 2008
Class Notes:  Introduction to Java


Logistics

  1. Second Day
    1. Syllabus + Course Policies
    2. Class mailing list
    3. Office Hours (DK: 12:30-1:30 in Wean 4614;  GB:  6:00-7:00 in Wean 5419D).
  2. Reading:
    1. L&L Chapter 1 (Introduction)
    2. L&L Appendix B (Number Systems)
    3. L&L Appendix C (Unicode)
  3. Hw1: due tomorrow at start of class (no late hw accepted!)
  4. Quiz0 (practice): Tomorrow  (treat this as a real quiz!)
  5. Quiz1 (real):  Thursday

Topic Outline:

  1. Quick Q's
    1. What is log381?  log2512?  log2(1k)?  log2(1m)? log2(1b)?  log2(2b)? log2(4b)?
    2. Roughly when will computers be 1m times faster than today?
    3. What is the Unicode value for 'A'? 'Z'?  '0'?  '9'?  ' ' (space)?
    4. For any letter, what is the difference between its Unicode value for lowercase versus uppercase?
       
  2. Installing Java, DrJava, JCreator
     
  3. Hello World
    1. Install software (Java + DrJava/JCreator/OtherIDE)
    2. Edit HelloWorld.java  <--- Java source file
      // HelloWorld.java 
      public class HelloWorld { 
         public static void main(String[] args) { 
            System.out.println("Hello World!"); 
         } 
      }
    3. Compile with "javac HelloWorld.java" to create HelloWorld.class  <-- Java bytecode file
    4. Interpret with "java HelloWorld"  <-- The JVM (Java Virtual Machine) interprets the bytecode
       
  4. Vocabulary:
    1. Sun, Java, Java SE, Java ME, Java EE, Java 1.4, Java 1.5, Java 1.6, JRE, JVM, Browser, Plug-in, Applet, Web Start,  jar file, JDK (or Java SDK),  Compiler, Interpreter, Editor, IDE, Libraries (Base Libraries, Swing, etc)
    2. Class
    3. Identifier
      1. Class names are UpperMixedCase
      2. Variable and Method names are lowerMixedCase
    4. Main method
    5. Comments
      1. End-of-line Comments  // like this
      2. Block Comments   /* like this */
      3. Good Comments (clear, concise, appropriate) and Bad Comments (unclear, verbose, inappropriate -- too many / too few)
    6. String literal  "like this"
    7. System.out.println method
    8. Reserved Words (see p. 31)
    9. Identifiers Revisited:  Read The Purple Boxes!!!
    10. White space
    11. Java Code Conventions (Style Guide)
    12. Syntax versus Semantics
      "Time flies like an arrow."
      "The senator was trapped in one bad lie after another."  (Is the senator a liar or just a bad golfer?)
    13. Errors
      1. Compile-time error (Syntax error)
      2. Runtime error ("crash")
      3. Logical Error
         
  5. Problem Solving
    1. Define the problem
    2. Design the solution
    3. Implement the solution
    4. Test the solution
    5. Revise the problem or the design as needed (ie, go back to step 1 or step 2)
       
  6. Time permitting:  skim chapter 1 and/or time on hw1 (due tomorrow!)

carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem