1 / 6

Java Brief Review

Java Brief Review. Java’s strengths Object-oriented terminology Inheritance Interfaces An example with inheritance and interfaces: class VisibleDataStructure. Java’s Strengths. Supports the objected-oriented paradigm Permits client-side execution of programs ( Applets ) on web pages.

alphad
Télécharger la présentation

Java Brief Review

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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 -

  2. 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 -

  3. 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 -

  4. 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 -

  5. 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 -

  6. 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 -

More Related