190 likes | 206 Views
Quizz Results. Go over quizz quesitons. Bing (96/100) and Minsik (96/100) to explain answers. I will not record your grade, if I don't get the quizz back. Elipses. int... passed into method as int[] Object... passed into method as Object[] Date... passed into method as Date[] etc.
E N D
Go over quizz quesitons • Bing (96/100) and Minsik (96/100) to explain answers. • I will not record your grade, if I don't get the quizz back.
Elipses • int... passed into method as int[] • Object... passed into method as Object[] • Date... passed into method as Date[] • etc.
Casting • Casting down may be done ONLY down the class hierarchy. • Casting up is not required because a subclass object may always be stored in a superclass reference (or an interface that it implements).
Reflection • If your program is written well and adheres to the principals of polymorphism, then you don't really need reflection. • It's nice to know you have it when testing/debugging though.
Recursion • Often times recursion is simpler than iteration. • Certain applications require recursion, such as binary trees. • Let's see some examples.
Intro to Data Structures in Java • Single Lined List • Stack • Binary Tree • others...
Inner and Anonymous Classes • Though you are captive in the OO paradigm, you can use inner classes and anonymous classes to get around this constraint and write procedural-like code. • Often times, no one but the enclosing class cares about an object. In this case, you may consider using inner or anonymous classes.
WindowsBuilderPro by Google • http://download.eclipse.org/windowbuilder/WB/release/R201109201200/3.7/ • b,y,c,n,s,l,d,f,str; get rid of these in Window || Preferences || Java || Code Style || Fields. Otherwise, they will hose you in WB.
Constructors • Constructors are optional. If your class is just a static driver; i.e. it just has a static main method, then no need to instantiate it; and no need for constructor. • If your class is a "java bean" -- a class that models a real world object (noun) in your system, then it should have a constructor. House, Car, Person, etc. • If you don't provide a constructor, a no-args constructor is provided automatically. • You can, and often want, more than one constructor with different signatures. • You call a constrcutor with the 'new' keyword.
Model a system • Object-oriented programming is about modelling a system. • Write the problem out as requirements -- this will essentially be a math world problem (your favorite kind to solve!) • Your computer objects map directly to real-world objects (nouns). • Your methods map directly to real-world actions (verbs).
Write a very simple application for a contact manager. The the sake of simplicity, each contact will have a name and a phone number only. The user should be able to create new contacts and diplay all contacts. Build a GUI using WindowBuilder and Swing.
Interfaces • A class implements an interface rather than extends it. Any class that implements the interface must override all the interface methods with it's own methods. • Interface names often end with "able" to imply that they add to the capabilty of the class. • An interface is a contract; it defines the methods