Dale Roberts Introduction to Java - Access Specifiers Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.

Slides:



Advertisements
Similar presentations
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Advertisements

Dale Roberts Introduction to Java - First Program Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
Dale Roberts Object Oriented Programming using Java - Inheritance Overview Dale Roberts, Lecturer Computer Science, IUPUI
Dale Roberts Object Oriented Programming using Java - Inheritance Constructors Dale Roberts, Lecturer Computer Science, IUPUI
Dale Roberts GUI Programming using Java - Mouse Events Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Syntax & terminology review While the following slides are not exactly what we did on the board (object diagrams are not shown here) they cover most of.
1 Composition A whole-part relationship (e.g. Dog-Tail) Whole and part objects have same lifetime –Whole creates instance of part in its constructor In.
 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Association Also called “knows a”. A relationship of knowing (e.g. Dog-Collar as opposed to Dog-Tail)
Fall 2005CSE 115/503 Introduction to Computer Science I1 Composition details Recall, composition involves 3 things: –Declaration of instance variable of.
1 Classes and Objects. 2 Outlines Class Definitions and Objects Member Functions Data Members –Get and Set functions –Constructors.
Dale Roberts Object Oriented Programming using Java - Class Constructors Dale Roberts, Lecturer Computer Science, IUPUI Department.
Object Oriented Programming using Java - Polymorphism
Classes and Class Members Chapter 3. 3 Public Interface Contract between class and its clients to fulfill certain responsibilities The client is an object.
Dale Roberts Procedural Programming using Java Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
Dale Roberts Object Oriented Programming using Java - Packages Dale Roberts, Lecturer Computer Science, IUPUI Department.
Dale Roberts Program Control using Java - Boolean Expressions Dale Roberts, Lecturer Computer Science, IUPUI Department of.
Dale Roberts Object Oriented Programming using Java - Enumerations Dale Roberts, Lecturer Computer Science, IUPUI Department.
Dale Roberts 1 Classes Constructors & Destructors Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer.
Dale Roberts GUI Programming using Java - Event Handling Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts GUI Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts Program Control using Java - Selection Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts GUI Programming using Java - GUI Components Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts Object Oriented Programming using Java - OOD to OOP: ATM Case Study Dale Roberts, Lecturer Computer Science, IUPUI
Dale Roberts Program Control using Java - Repetition Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts CSCI 230 Functions Scope, Parameter Passing, Storage Specifiers Department of Computer and Information Science, School of Science, IUPUI Dale.
Chapter 3 Part I. 3.1 Introduction Programs written in C ◦ All statements were located in function main Programs written in C++ ◦ Programs will consist.
Dale Roberts Object Oriented Programming using Java - Final and Static Keywords Dale Roberts, Lecturer Computer Science, IUPUI
Classes: user-defined types. Organizing method with a class A class is used to organize methods * Methods that compute Mathematical functions * The Scanner.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 9: Continuing with classes.
AP Computer Science A – Healdsburg High School 1 Unit 9 - Why Use Classes - Anatomy of a Class.
 2005 Pearson Education, Inc. All rights reserved. 1 Introduction to Classes and Objects.
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Dale Roberts Introduction to Java - Input, Program Control and Instantiation Dale Roberts, Lecturer Computer Science, IUPUI
Dale Roberts Object Oriented Programming using Java - Getters and Setters Dale Roberts, Lecturer Computer Science, IUPUI
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
INTRODUCTION TO CLASSES & OBJECTS CREATING CLASSES USING C#
Introduction to Classes and Objects CS-2303, C-Term C++ Program Structure Typical C++ Programs consist of:– main –A function main –One or more classes.
Dale Roberts GUI Programming using Java - Windowing Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
 2007 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
GUI Programming using Java - Event Handling
Object Oriented Programming using Java - Composition
3 Introduction to Classes and Objects.
GUI Programming using Java - Key Events
Introduction to Classes and Objects
Yanal Alahmad Java Workshop Yanal Alahmad
Abstract Data Types Polynomials CSCI 240
Object Oriented Programming using Java - Class Instance Variables
Variable Declarations, Data types, Expressions
Variable Declarations, Data types, Expressions
Classes Access Specifiers
Program Control using Java - Theory
GUI Programming using Java - Mouse Events
Week 3 Object-based Programming: Classes and Objects
Classes Copy Constructors
Pointers Call-by-Reference CSCI 230
Classes Static Members
NAME 436.
Visual Programming Lecture 4.
Dale Roberts, Lecturer IUPUI
Dale Roberts, Lecturer IUPUI
Classes Introduction CSCI 240
Classes and Objects Systems Programming.
Classes Class Data Members & Initializers
Abstract Data Types Stacks CSCI 240
Classes Member Qualifiers
Presentation transcript:

Dale Roberts Introduction to Java - Access Specifiers Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School of Science, IUPUI

Dale Roberts 2 Access Modifiers public and private private keyword Used for most instance variables private variables and methods are accessible only to methods of the class in which they are declared Declaring instance variables private is known as data hiding public keyword Exposes variables or methods outside the Class. Declaring public methods is know as defining the class’ public interface. Return type Indicates item returned by method Declared in method header

Dale Roberts 3Outline GradeBo ok.java Instance variable courseName set method for courseName get method for courseName Call get method

Dale Roberts 4Outline GradeBo okTest.j ava (1 of 2) Call get method for courseName

Dale Roberts 5Outline GradeBo ok.java (1 of 2) Constructor to initialize courseName variable

Dale Roberts 6Outline GradeBook.j ava (2 of 2)

Dale Roberts 7Outline GradeBookT est.java Call constructor to create first grade book object Create second grade book object

Dale Roberts 8Outline GradeBo okTest.j ava Call constructor to create first grade book object Create second grade book object

Dale Roberts Acknowledgements Pearson Education, Lewis and Loftus. Deitel, Java How to Program /language.impl.overview.pdf /language.impl.overview.pdf