Last update: April 4, 2012
This webpage section includes examples seen in class.
The information in this page will be updated as the course
progresses.
- Java Basics
- Possible structures of a java class (notice also local and global variables)
- Procedural decomposion, more than one method in the class
- Some testing about casting
- Java Basics, interaction with the user, Scanner class
- Methods and Parameters, first encounter
- Flow of Control (chapter 4)[chapter 5 L&L 6th ed] [Chapters 5 and 6, l&L 7th ed]
- Writing Classes (chapter 5)[chapter 4 and 6 L&L 6th ed, chapters 4 &6 in L&L 7th ed]
- current textbook
- [L&L 6th ed and L&L 7th ed]
- Listing 4.1: RollingDice.java
- Listing 4.2: Die.java (the posted version
corresponds to the current textbook, but it works fine with RollingDice.java)
- Listings 4.3 and 4.4: Transactions.java and Account.java
- Listings 5.3 and 5.4: CoinFlip.java and Coin.java
- more examples
- Writing Classes combined with Arrays of objects, UML and flowchart diagrams
(chapters 5 and 7 [L&L 6th ed chapters 4 and 7] [L&L 7th ed chapters 4, parts of 7 and 8 ])
- Design and Coding Guidelines
- Recursion
- Array Lists
- Drawing - Basic Graphics (to be used for Lab week #11)
- Inheritance Basic:
- Shapes hierarchy:
Shape.java, Circle.java,
Rectangle.java, Square.java,
PairDoubles.java,
TesterShape.java
- Polymorphismm: Declaring a variable as reference
object of parent class, creating the object as instance of child class - examples.
OTesterPolym.java, uses
OChild.java, OParent.java
- Polymorphismm: when methods are only defined in child class - examples.
PChild1.java, PChild2.java,
PParent.java,
PTester.java
- Shapes hierarchy with abstract class:
ShapeA.java, CircleA.java,
RectangleA.java, SquareA.java,
PairDoubles.java, TesterShapeA.java
- Exceptions
- ...