COM2302-OOP 07/08
Object Oriented Programming course in Faculty of Applied Sciences
Saturday, July 31, 2010
Abstract Classes versus Interface
Unlike interfaces, abstract classes can contain fields that are not static and final, and they can contain implemented methods. Such abstract classes are similar to interfaces, except that they provide a partial implementation, leaving it to subclasses to complete the implementation. If an abstract class contains only abstract method declarations, it should be declared as an interface instead.
Multiple interfaces can be implemented by classes anywhere in the class hierarchy, whether or not they are related to one another in any way. Think of Comparable or Clonable, for example.
By comparison, abstract classes are most commonly sub classed to share pieces of implementation. A single abstract class is sub classed by similar classes that have a lot in common (the implemented parts of the abstract class), but also have some differences (the abstract methods).
Sunday, July 25, 2010
Advantages of UseCase Diagrams
Normally use case diagrams are facilitated by the different entities involving in the software development. Those entities are client, development team , QA staff, Project Manager (PM) and System architect.
You are encouraged to elaborate this statement and further it will help your presentation preparation.
Monday, June 14, 2010
Interface
Questions
- What methods would a class that implements the
java.lang.CharSequenceinterface have to implement? - What is wrong with the following interface?
public interface SomethingIsWrong {
void aMethod(int aValue){
System.out.println("Hi Mom");
}
} - Fix the interface in question 2.
- Is the following interface valid?
public interface Marker {
}
Monday, March 22, 2010
Questions
Try this Questions;
1:Real-world objects contain ___ and ___.
2:A software object's state is stored in ___.
3:A software object's behavior is exposed through ___.
4:Hiding internal data from the outside world, and accessing it only through publicly exposed methods is known as data ___.
5:A blueprint for a software object is called a ___.
6:Common behavior can be defined in a ___ and inherited into a ___ using the ___ keyword.
7:A collection of methods with no implementation is called an ___.
8:A namespace that organizes classes and interfaces by functionality is called a ___.
9:The term API stands for ___?
want you check your answer,
http://java.sun.com/docs/books/tutorial/java/concepts/QandE/answers.html-
Exercises
1. Create new classes for each real-world object that you observed at the beginning of this trail. Refer to the Bicycle class if you forget the required syntax.
2. For each new class that you've created above, create an interface that defines its behavior, then require your class to implement it. Omit one or two methods and try compiling. What does the error look like? 3.whats meaning Object Oriented Modeling.What are difference Object oriented modeling and object oriented programming?
please explain this exercises for our knowledge.
Objects
The super class
eg:
In the case of the Mammals class,all mammals have similar attributes.such as eye color and hair colors,as well as behaviors such as gone rate internal heat and grow hair.so it is not necessary to duplicate then down the inheritance free for each type of mammal