Você está na página 1de 16

EE2E1.

JAVA Programming

Revision Lecture
The exam
The EE2E exam comprises both questions
about Java programming and questions
about (UML) OOD
The paper is in 2 sections answer 2 out
out 4 questions (1 from each section) in 1
and hours
Revision
The following EE2E1 topics have been
covered in lectures
Classes

Inheritance/interfaces

Swing/GUIs

Files/Streams and Exceptions

Multi-threading

Network Programming
Classes
Main revision points
The difference between an object and a class
Encapsulation private, public members
Class instance variables and methods (member
functions)
Static and non-static class members
How to refer to a static class member
(through the class name) and a non-static
member (through the object name)
Classes (cont)
Main revision points (cont)
Constructors used for initializing
objects
The this self-reference pointer
Inheritance
Main revision points
Derived class objects inherit base class
attributes and contain their own class specific
attributes
Abstract classes

Created when it is not sensible to provide an

implementation of a particular method


Objects of an abstract class cant be
instantiated
The Object superclass generic programs
Inheritance (cont)
Main revision points (cont)
Polymorphism is a key aspect of
inheritance
A base class object variable (pointer) can

refer to a derived class object


Derived class methods are called via the
base class pointer
Interfaces
Main revision points
Interfaces avoid the use of multiple
inheritance
They are similar to abstract classes but
contain only methods and not instance
variables
Instance objects cant be instantiated
Useful for generic programming
Swing/GUIs
Main revision points
Swing/AWT are the main graphics/GUI
libraries
A graphics program comprises graphics
containers and components (Frames, Panels,
Buttons etc)
Its pretty easy to display graphics and text in
graphics containers
A graphics program runs in a separate thread to
the main thread and essentially listens for
user/event interactions
Files/Streams and Exceptions
Main revision points
Java has many classes supporting I/O

A stream is simply a sequence of bytes

Can attach streams to files

Can do I/O on formatted or compressed


data by layering appropriate stream
objects
File I/O makes extensive use of
exceptions for handling error conditions
Files/Streams and Exceptions
(cont)
Exceptions are the preferred method of
error handling
Object oriented approach

Exception objects contain information

about the error


The try{} catch{} mechanism is used

Exceptions can be handled locally or

thrown on
Multi-threading
Main revision points
A Java program can execute in separate threads

Java threads can share data


Threads can be initiated by overriding the run()
method of the Thread class
Threads can run with a priority which can be
set
Threads are time-sliced and threads are pre-
empted by threads of equal or higher priority
Synchronised methods resolves data conflicts
when multiple threads access shared objects
Network Programming
Main revision points
Client/Server architecture

A server listens for a client to connect

Java has a Socket class which is an abstraction


of a network end point
Reading/writing a socket is the same as
reading/writing to a stream attached to a file
A web server provides html for a clients web
browser
For multiple clients, a multi-threaded server is
required
Java has a URL class enabling easy network
connection via a url
Other issues
I have not yet received the 2nd programming
reports
However, I will try and get them marked before
the exam on 14th May
Grades will be displayed on the EE2E1 web site
before you sit the exam
I will also combine the 2 programming report
marks so you know your overall EE2E1
coursework grade (comprising 25% of the EE2E
module) before you sit the exam (hopefully!)
FAQs
Will I have to write any code?
Yes but not too much

Will syntax errors be penalised?


No!

Is all the syllabus examinable?


No. Only half but Im not going to tell

you which half!


Thank you all very much!
Good luck in the exam!!

Você também pode gostar