Computer Science 15-100 (Sections T & U), Spring 2008
Class Notes: Introduction to Java
Logistics
- Second Day
- Waitlists: see me today
- Syllabus + Course Policies
- Class mailing list
- Reading:
- L&L Chapter 1 (Introduction)
- L&L Appendix B (Number Systems)
- L&L Appendix C (Unicode)
- Hw1: due Friday (tomorrow at 10am by email to your CA)
- Quiz1: on Tuesday
Topic Outline:
- Installing Java, DrJava, JCreator
- Hello World
- Install software (Java + DrJava/JCreator/OtherIDE)
- Edit HelloWorld.java <--- Java source file
- Compile with "javac HelloWorld.java" to create HelloWorld.class
<-- Java bytecode file
- Interpret with "java HelloWorld" <-- The JVM (Java Virtual
Machine) interprets the bytecode
- Vocabulary:
- 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)
- Class
- Identifier
- Class names are UpperMixedCase
- Variable and Method names are lowerMixedCase
- Main method
- Comments
- End-of-line Comments // like this
- Block Comments /* like this */
- Good Comments (clear, concise, appropriate) and Bad Comments
(unclear, verbose, inappropriate -- too many / too few)
- String literal "like this"
- System.out.println method
-
Reserved Words (see p. 31)
- Identifiers Revisited:
Read The Purple Boxes!!!
- White space
-
Java
Code Conventions (Style Guide)
- 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?)
- Errors
- Compile-time error (Syntax error)
- Runtime error ("crash")
- Logical Error
- Problem Solving
- Define the problem
- Design the solution
- Implement the solution
- Test the solution
- Revise the problem or the design as needed (ie, go back to step 1 or
step 2)
- 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