60 likes | 78 Views
Learn about Java's strengths in supporting OOP paradigm, client-side execution with applets, portability, networking capabilities, large standard library, syntax similar to C++, inheritance, interfaces, and a practical example with VisibleDataStructure. Explore object-oriented terminology like classes, instances, methods, and the concept of inheritance with subclasses and abstract classes. Understand the role of interfaces in enforcing calling conventions within Java applications. Dive into the VisibleDataStructure example detailing an abstract class and its subclasses.
E N D
Java Brief Review • Java’s strengths • Object-oriented terminology • Inheritance • Interfaces • An example with inheritance and interfaces: class VisibleDataStructure CSE 341, S. Tanimoto Java brief review -
Java’s Strengths • Supports the objected-oriented paradigm • Permits client-side execution of programs (Applets) on web pages. • Provides portability of applications, including a standard graphics platform • Supports networking including communication, parallelism, security. • Provides a large standard library. • Syntax close to that of C++. CSE 341, S. Tanimoto Java brief review -
Object-Oriented Programming Terms • object: encapsulation of data and code. • class: a formal category of objects. • instance: an object, in the context of a particular class. • message: a request to an object or class for data or service. • sender: the object or class from which the message comes. • receiver: the object or class to which the message is sent. • method: a function within a class that responds to a message. CSE 341, S. Tanimoto Java brief review -
Inheritance • One class can serve as a base class for defining a new, more restricted class called a subclass. • Any instance of a (derived) class inherits the data members and method members of its parent class. • A subclass typically provides additional member variables and methods. • A subclass may override a member inherited from its parent by redefining it. • An abstract class doesn’t provide full implementations of all of its methods and is typically used as a means to provide a uniform protocol to two or more separate subclasses. • The visibility of names within and across inheritance hierarchies is controlled by the keywords public, private, protected. The default access control is “package” which itself defaults to accessibility within compilation units. CSE 341, S. Tanimoto Java brief review -
Interfaces • Since Java does not permit multiple inheritance with subclassing, (and therefore might have made it difficult for one class to integrate the functionality of several others) it compensates by providing formal interfaces. • An interface consists of a name and a protocol (list of functions and their formal parameter types). • A class may subclass at most one superclass but may implement any number of interfaces. • A class that implements an interface must provide an implementation for each function appearing in the interface. • Interfaces do not provide any code and are used to enforce (at compile time) calling conventions within software applications. • Interfaces can be extended. CSE 341, S. Tanimoto Java brief review -
An Overview of the VisibleDataStructureexample • VisibleDataStructure is an abstract class • VisibleArray extendsVisibleDataStructure • VisibleVerticalArray extends VisibleArray • VisibleHorizontalArray extends VisibleArray • TestVisibleArray instantiates VisibleVerticalArray , and VisibleHorizontalArray CSE 341, S. Tanimoto Java brief review -