ITEC 120: Week 4
Lab 7
Lab 6
Comments on quizzes
Constant needed
Constant style
Meaningful names
Indentation
Comment style
Stay ahead of the wave!
Selected Topics from Chapter 3:
Classes are (user defined) types
Good style: class names are capitalized
object.method() invokes a method
Good style: method names not capitalized
Methods do one of the following:
perform services (eg System.out.println();
return values to use in expressions and assignments (scan.nextInt();
Aliases
Assignment of reference variables copies pointer
Can have two references to same object
An
alias
of a reference is another reference with a different name (eg two variables with same pointer value)
Be careful with references: changes made via one alias are reflected for all aliases
Garbage:
an object with no references to it
garbage is no longer accessible)
Garbage collection
Return garbage to runtime system for reuse
automatic in java
not automatic in C, C++, Ada, FORTRAN, COBOL
automatic in some OO languages: Eiffel, smalltalk
automatic in scripting languages like perl, php, vb(?)
automatic in AI languages like LISP, PROLOG
String class
Special notation for creating Strings
Strings are
immutable
Strings methods
String characters indexed (starting at 0)
Packages
Libraries: tools for programmer
Packages: organization tool for libraries
organization tool for libraries
package hierarchy: use dot notation (eg java.util.Scanner)
Style: not capitalized
Import: saves programmer typing
packages random and class
Method Declarations: parameters and return types
Formatting Output
Random Numbers
Chapter 3 Powerpoint Slides
Examples from Chapter 3
Previous Week
Entire Semester
Next Week
--
ITEC 120 Home Page
, --
Dr. Okie's Home Page
,
Last modified on Saturday, 24-Jan-2009 13:08:05 EST
Check my grades