CSCI 202: Object-Oriented Programming
Programs designed in class
- Adding Drawable interface to the hierarchy of shapes: Shape.java, Rect2.java and Circ2.java
- Drawing shapes
- First approach: DrawShapes1.java try it
- Second approach: DrawShapes2.java try it
- Third approach: DrawShapes3.java try it
- Comparing shapes
- Making Circ3.java and Rect3.java implement interface Comparable
- A better approach by using the Java 5 generics: Circ4.java and Rect4.java
- Comparing shapes: TestShapes3.java
- Sorting circles: SortCircs.java
- Same task by using interface Comparator: SortCircs2.java
- Searching an array of objects: SearchObj1.java
- Same task by using the Java 5 generics: SearchObj2.java
- Same task by using the method binarySearch of class Arrays: SearchObj3.java
- A trivial approach: CloneShapes1.java
- Implementing interface Cloneable: CloneShapes2.java
- Checking if an interface is implemented by a class: CheckInterface.java
- First approach (based on the ActionListener interface and javax.swing.Timer class): TimerTest1.java
- Second approach (based on the Runnable interface and java.util.Timer class): TimerTest2.java
- Third approach: using anonimous inner class: TimerTest3.java