Java Keywords CSE 115 Spring 2006. Purpose This set of slides contains a running list of the keywords that we have talked about so far this semester and.

Slides:



Advertisements
Similar presentations
1 Classes and Objects in Java Basics of Classes in Java.
Advertisements

Final and Abstract Classes
INHERITANCE BASICS Reusability is achieved by INHERITANCE
METHOD OVERRIDING 1.Sub class can override the methods defined by the super class. 2.Overridden Methods in the sub classes should have same name, same.
OOP: Inheritance By: Lamiaa Said.
1 Chapter 6: Extending classes and Inheritance. 2 Basics of Inheritance One of the basic objectives of Inheritance is code reuse If you want to extend.
Week 8 Recap CSE 115 Spring Composite Revisited Once we create a composite object, it can itself refer to composites. Once we create a composite.
Inheritance Java permits you to use your user defined classes to create programs using inheritance.
Objectives Introduction to Inheritance and Composition (Subclasses and SuperClasses) Overriding (and extending), and inheriting methods and constructors.
ITEC200 – Week03 Inheritance and Class Hierarchies.
Encapsulation, Inheritance & Interfaces CSE 115 Spring 2006 February 27, March 1 & 3, 2006.
CSE 115 Week 10 March , Announcements March 21 – Lab 7 Q & A in lecture March 21 – Lab 7 Q & A in lecture March 26 – Exam 7 March 26 – Exam.
Week 4 Recap CSE 115 Spring Formal Parameter Lists Comma-separated list of formal parameters Formal parameters are listed giving the type of the.
Slides prepared by Rose Williams, Binghamton University Chapter 13 Interfaces and Inner Classes.
June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 3 Object Oriented Programming in Java Language Basics Classes,
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter N - 1 Chapter 13 Polymorphism is-a relationships Interfaces.
CS 2511 Fall  Abstraction Abstract class Interfaces  Encapsulation Access Specifiers Data Hiding  Inheritance  Polymorphism.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter N - 1 Abstract Superclasses and Abstract Methods When.
Week 3 Recap CSE 115 – Spring Constructor Special capability of a class that sets up the initial state of the object. Constructor definitions are.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter N - 1 Chapter 13 Polymorphism is-a relationships Interfaces.
Week 3 Recap CSE 115 – Fall Java Source Code File Made up of: Package declaration Class definition.
ISE 582: Web Technology for Industrial Engineers University of Southern California Department of Industrial and Systems Engineering Lecture 4 JAVA Cup.
8.1 Classes & Inheritance Inheritance Objects are created to model ‘things’ Sometimes, ‘things’ may be different, but still have many attributes.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Inheritance using Java
Classes and Class Members Chapter 3. 3 Public Interface Contract between class and its clients to fulfill certain responsibilities The client is an object.
Chapter 11 Inheritance and Composition. Chapter Objectives Learn about inheritance Learn about subclasses and superclasses Explore how to override the.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
1 Chapter 8 – Classes and Object: A Deeper Look Outline 1 Introduction 2 Implementing a Time Abstract Data Type with a Class 3 Class Scope 4 Controlling.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
CSE 341, S. Tanimoto Java brief review - 1 Java Brief Review Java’s strengths Object-oriented terminology Inheritance Interfaces An example with inheritance.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
Java Class Structure. Class Structure package declaration import statements class declaration class (static) variable declarations* instance variable.
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
Encapsulation, Inheritance, Composition. Class Methods Can be either void or return Can have parameters or not Must be static Should be public Know how.
Interfaces F What is an Interface? F Creating an Interface F Implementing an Interface F What is Marker Interface?
Programming in java Packages Access Protection Importing packages Java program structure Interfaces Why interface Defining interface Accessing impln thru.
Access Specifier. Anything declared public can be accessed from anywhere. Anything declared private cannot be seen outside of its class. When a member.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
POLYMORPHISM Chapter 6. Chapter Polymorphism  Polymorphism concept  Abstract classes and methods  Method overriding  Concrete sub classes and.
A Introduction to Computing II Lecture 3: Interfaces and Inheritance Fall Session 2000.
Inheritance & Method Overriding BCIS 3680 Enterprise Programming.
SUBCLASSES - JAVA. The Purpose of Subclasses Class Farm String getOwner() void setOwner(String s) int getSize() void setSize(int s) Class DairyFarm String.
JAVA ACCESS MODIFIERS. Access Modifiers Access modifiers control which classes may use a feature. A classes features are: - The class itself - Its member.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
Inheritance a subclass extends the functionality of a superclass a subclass inherits all the functionality of a superclass don't reinvent the wheel – "stand.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Java Interfaces CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University (see Chapter 9 of.
Written by: Dr. JJ Shepherd
A Concrete Presentation on Abstract Classes and Methods, Interfaces, and Polymorphism CSC 202.
Objects as a programming concept
Inheritance-Basics.
Final and Abstract Classes
Classes and Objects in Java
Classes and Objects in Java
Classes and Objects in Java
Chapter 3 Inheritance © 2006 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.
CS240: Advanced Programming Concepts
Class Inheritance (Cont.)
Object-Oriented Programming: Interface
Interface.
Interfaces.
Advanced Java Programming
CSE 1030: Implementing GUI Mark Shtern.
Chapter 14 Abstract Classes and Interfaces
Final and Abstract Classes
Extending Classes Through Inheritance
INTERFACES Explained By: Sarbjit Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
Presentation transcript:

Java Keywords CSE 115 Spring 2006

Purpose This set of slides contains a running list of the keywords that we have talked about so far this semester and a brief explanation of what each keyword does.

class (added 1/30/06) Indicates the start of the definition of a class. public class Name { }

new (Added 1/30/06) Indicates a call to a constructor Used when you want to create a new instance of an object Use: new constructorName();

package (Added 2/1/06) Indicates membership for a class in a particular package Packages correspond to directories on the file system Use: package nameOfPackage;

private (Added 2/3/06) Access control modifier (visibility) Only accessible from within the class

public (Added 2/3/06) Access control modifier (visibility) Accessible from everywhere and to everyone

void (Added 2/8/06) Used as a return type for a method. Indicates that the method does not return anything. public void methodName() { }

extends (Added 2/15/06) Indicates that the class you are writing has a superclass, which is an indication of inheritance. public class ClassName extends SuperClassName { }

this (Added 2/15/06) Self-reference Refers to the class itself Can be used to have the class call its own method this.methodName();

return (Added 2/17/06) Needed to indicate what value is being returned from a method that has a return type. public NonVoidType methodName() { //do some work return someValue; }

super (added 3/1/06) Indicates a call to the superclass’ method (either constructor or just a regular method). public ConstructorName() { super(param); } public void OverriddenMethod() { super.OverriddenMethod(); }

interface (added 3/3/06) Indicates the beginning of an interface definition. public interface InterfaceName { }

abstract (added 3/3/06) Indicates that a method is abstract (does not have a method body). public abstract void method(); OR abstract public void method();

implements (added 3/3/06) Indicates that the class you are writing implements an interface. public class Name implements InterfaceName { }