Home FAQ Overview Material Facilities Help Miscellaneous Exercises Exams
CS Announcements Syllabus Times Staff Advice Examples Projects Grading

Refer to these pages: exercises, projects, and exams.

Please note:

  • You benefit most by running these examples, not just reading!
  • The following code leaves most documentation up to you.
  • You might find some discrepancies between the lecture and files here.
  • Use at your own risk. You really should carefully test and try similar examples.
  • Date Description Program
    1/24 Demo: Basic Java program that does "nothing" demo0.java
    Demo: Hello, world! helloworld.java
    1/27 Demo: area of circle area1.java
    Booleans: truth table from logic truthtable.java
    Types: demonstration of different data types types.java
    Identifiers: demonstration of identifier syntax identifiers.java
    Case Sensitive: what does that mean? casesensitive.java
    Declare vs Assign: what is the difference? declare_vs_assign.java
    2/1 Conditionals: if, else if, else, I/O, formatting area2.java
    Conditionals: material discussed in section this week maxmin1.java
    2/3 Output: what if you need to "split" a string? split_string
    TokenReader: the joys of input (definitely check this out) tr1
    Assignment: swapping variable values swap
    2/4 Tracing and loops tracing
    2/7 Loops: Patterns for writing code (templates for grades example; highly recommended!) pattern
    Loops: Extended code for grades example for lecture (many goodies inside) grades
    2/9 Modulus (%) operator: explanations, descriptions, useful! modop
    Increment operator (++): brief demo increment_ops
    Prompting: long winded version reprompt
    Prompting: reprompting inside a loop (nested loops) reprompt2
    Prompting: more elegant examples prompt_user
    Nested loop: using while for nested loops nested1
    Nested loop: more compact version using for nested2
    2/14 OOP: Basics of objects and references oop0.java
    OOP: expanded version of oop1.java (more explanations) oop1.java
    2/17 OOP: example of bouncing ball -- need for exercise 3 ball0
    2/18 Nested Loops: Section example with while (row/col labels) MatrixLabels1
    Nested Loops: Section example with while (row/col labels) MatrixLabels2
    Nested Loops: Section example with for (row/col labels)  MatrixLabels3
    Nested Loops: divisibility example Divisibility5
    Nested Loops: mod example ReduceInteger
    2/23 OOP: graphics graphics0
    OOP: more boncing balls with methods (posted after lecture 2/24) balls_methods
    2/29 OOP: methods (some basics, local vars) methods1
    OOP: methods (default values) methods2
    OOP: methods (this) methods3
    OOP: methods (return vs printing) methods4
    OOP: null reference null0
    OOP: graphics (circles) graphics_circle
    3/1 OOP: graphics (very basic, lots of explanations!) g0
    OOP: graphics (same as g0, explanations removed) g0_brief
    OOP: grapics (same as g0, uses constructor) g0_brief2
    OOP: aggregate objects (things like Person class) has_a1
    OOP: more aggregate objects has_a2
    OOP: yet another aggregate object has_a3
    OOP: this (see methods3 and "this" ;-) this1
    OOP: Strings (as objects -- see L&L 2.5) strings0
    3/2 Random (notes for help on using Math.random()) random1
    3/7 OOP: constructors (basic) constr0
    OOP: constructors (use constructor to initialize a value) constr1
    OOP: constructors (just like constr1, but use this instead) constr2
    OOP: constructors (using multiple constructors) constr3
    OOP: method overloading mo0
    3/9 OOP: methods pass by value pass0
    OOP: how do "objects get passed"? pass1
    pass1 box
    OOP: more on "pass by reference" pass2
    pass2 box
    OOP: more on "pass by reference" (with aliases) pass3
    pass3 box
    3/14 OOP: Encapsulation banking
    3/15 OOP: More Encapsulation raise
    OOP: static static0
    OOP: more about static static1
    OOP: even more about static static2
    OOP: just when you thought you had enough static static3
    final (and a little bit of static) (Fixed -- link was broken) final0
    3/26 OOP: info on constructors Constructor
    OOP: default values of all kinds of variables defValue
    OOP: a thought exercise on instance variables iv
    3/28 arrays: the tedious approach -- what NOT to do array_tedious
    arrays: the better approach -- introduces many features array_better
    4/5 arrays: array of objects array_objects0
    characters: some info on char chars0
    strings: more info on strings (see strings0) strings1
    iv2: DIS playing around with instance variables (inspired by student - see iv1) iv2
    4/9 arrays: declaring, instantiating arrays, initializer lists, anonymous arrays (updated) initlist0
    arrays: array of arrays (name change from array_of_arrays0 -- this is the same example) aoa0
    arrays: array of arrays: ways to create -- has box diagrams! aoa1
    arrays: array of arrays: using aliases aoa2
    arrays: array of arrays: syntax issues with initializer lists and anonymous arrays aoa3
    arrays: array of arrays: row major vs column major aoa4
    arrays: ragged arrays array_ragged0
    arrays: find the mode of an array of integers (see array_better for max) array_mode
    4/10 arrays: calling methods; returning references to arrays array_methods0
    4/12 arrays: select sort select_sort
    arrays: select sort and insert sort (see select_sort.java -- very similar) sorting
    arrays: select sort and insert sort (a bit less intricate, more explanations) sorting1
    4/25 arrays: zero? array_zero
    iv3: more playing around with instance variables (see iv1 and iv2) iv3
    inheritance: basics inherit0
    inheritance: simple examples inherit1
    inheritance: using constructors inherit2
    inheritance: further exploration of inherit2 example  inherit3
    inheritance: setup for inherit5 inherit4
    inheritance: subclasses can access instance and class variables of superclass inherit5
    inheritance: another demonstration of inherited instance variables  inherit6
    inheritance: lots about constructors and super inherit7
    4/25 strings: strings and references -- had a typo in the comments string2
    (cont.) inheritance: another example of how subclasses assign and access inherited instance variables inherit8
    inheritance: a reworking of the iv1, iv2, and iv3 examples iv4
    5/1 inheritance: OPTIONAL: an interesting consequence on creating a subclass iv5
    inheritance: calling methods using super (relates to P7) inherit9
    5/2 inheritance: OPTIONAL using super on instance variables inherit10
    threads: OPTIONAL multithreading thread1
    Object: objects always inherit from Object object0
    Object: using default toString()  object1
    Object: overrriding toString()  object2
    Object: using equals() object3
    5/3 Object: OPTIONAL (but cool, so check it out anyway :-) using clone() object4
    5/4 inheritance: polymorphism poly

    Back to Top
    Back to CS100 Home