Copyright © 2011/12 School of Electronic Engineering, DCU, Ireland
Please notify me by e-mail if you spot any errors or omissions. I would also be interested in any feedback you may have about these documents.
This document was written by Dr. Derek Molloy <Derek.Molloy@dcu.ie>
for students in the School Of Electronic Engineering, Dublin City
University. You may not pass this document to anybody.
By using this document, you must obey the following conditions: You must be taking this module for personal private study, and will not reuse any of the materials supplied (i.e. course notes, software ..etc.) for any purpose other than personal private study. You are bound by the copyright statement "This Hypermedia document (Object-Oriented Programming For Engineers) and its associated materials are copyrighted © 1999-2011/12. All rights reserved. While every reasonable effort is made to ensure the reliability and continuity of this Hypermedia document, this material is supplied for general reference only and should not be relied on without further specific inquiry. SUBSCRIBERS are granted a limited license to make a single copy of documents in this Hypermedia document in print and/or electronic form for personal research or educational use. Course notes may be downloaded, stored on a hard drive or other storage device, or printed in hard copy form, with the following restrictions and exceptions: Systematic or multiple-copy reproduction or republication; electronic retransmission to another location; print or electronic duplication of any material in this course for a fee or for commercial purposes; or altering or recompiling any contents of the course and its associated materials are not permitted."
By choosing to view, download, or print any portion of this course and its associated materials, you agree to all the provisions of the copyright law protecting it and to the terms and conditions established by the copyright holder.
This document is formatted into chapters and sections. You can use the controls at the top and bottom of the document to move between sections. The back and forward buttons refer to the next and last section as organised in the notes - not the last section you have visited. At any time you can return to the higher-level index by using the up button at the bottom centre of the page. The home button in the same location will return you to the main index. This is a dynamic document that will be updated during the year. You can select to download a .pdf version of this document, but please be aware that any additions made to the document will automatically be made to the .pdf version. If you choose to download and print the .pdf version at the start of the year, please check for changes.
The notation in this document is as follows:
A class is represented as SomeClass
, an interface by
SomeInterface
and and exception by
SomeException
- All classes, interfaces and exceptions begin
with a capital letter and further words in the name are also capitalised. If a class, interface or
exception is underlined (hyperlinked) then you can follow the link to the API documentation directly, so
for example String
will display the Java API documentation for
the String
class. This is linked to the SUN site, so you will have to remain
on-line to use this feature. It will open the pages in a new window (always the same one).
An object is represents as someObject
- All objects begin with
a lower-case letter and further words in the object name are capitalised.
A method is represented as someMethod()
even if it has
parameters. All methods begin with a lower-case letter.
In general language a literal is given as public
, a
type as int, and a variable as
someInt
.
A command, such as at the DOS prompt is represented as javac Test.java for example.
A filename is represented as SomeFile.txt
.
If something is important it is represented like this.
This document has been written in XML and is parsed to HTML and PDF using the following technologies: Docbook (document standard and DTD), Saxon (XML parser), XSLT (for HTML output), FOP (for PDF output), JIMI (for image formatting), CSS 2 (for local browser style), XSL (for HTML and PDF formatting) and edited in Cooktop (XML editor). I have tried to make the HTML output as generic as possible to work on all browsers. This document has been checked for CSS validity by WC3 - CSS Validator. All images have been edited in Adobe Photoshop and Illustrator and converted to .gif, .png formats or .eps format (for some PDF images). Encryption of PDF documents has been implemented using Bouncy Castle.
All Java code has been tested with JDK 1.4.2 and run under Windows XP Professional - If you notice any problems on other JDK versions or operating systems, please notify me.
The multi-choice questions are implemented using Java Servlets on the Tomcat/JBoss servlet/EJB engine, built with an XML standard and internal Xerces and Xalan parsing. Output is styled using CSS only.
2011/12
Dedicated to the hard work of all the students that have completed this module, with special thanks to those who have provided suggestions or helped correct errors and omissions throughout the years.
Table of Contents
List of Figures
Television
class example.Television
objects example.Television
interface example.Television
class example showing encapsulation.Duck
class showing inheritance.Vehicle
class.draw()
method.draw()
method in the Vehicle
class.draw()
method in the Vehicle
and
Car
classes.Bank
class.Account
class.Transaction
class.if
structure.if else
structure.while
structure.do while
structure.for
structure.switch
structure.Account
ClassAccount
and CurrentAccount
class relationship.Account
and CurrentAccount
class relationship.ptrA
and ptrB
have the same static and dynamic types.ptrA
has static type Account
and dynamic type CurrentAccount
.ptrB
has static type CurrentAccount
and dynamic type Account
.Account
class with Multiple Constructors example output.FundTransfer
class.CashSave
class.Account
class with static state example output.Account
class.Account
and CurrentAccount
classes.Cashsave
class example.CashSave
class example.CashSave
class example.Person
class.Person
and Staff
class hierarchy.ChessSolution
applet with a square Size of 2, 10, 20 with a reversal in starting colour.InetAddress
Class ExampleJSlider
ExampleJProgressBar
ExampleJToggleButton
component example (a) selected (b) not selected.JToolBar
Example Application. Toolbar (a) at top (b) at bottom.JToolBar
Example with Floating ToolbarJMenuBar
ExampleJTabbedPane
Example (a) first tab (b) second tab.JInternalFrame
ExampleJSplitPane
Example Application. Split (a) centre right (b) more right of centre.JFileChooser
Dialog in Action.JList
Example ApplicationJTree
Example ApplicationJTable
Example Application. (a) As it appears on startup (b) moved and edited a bitJTable
Example Application with ListSelection
events.ChessSolution
applet with a square Size of 2, 10, 20 with a reversal in starting colourList of Tables
© 2006
Dr. Derek Molloy
(DCU).