Haidong Xue Summer 2011, at GSU

Slides:



Advertisements
Similar presentations
This is Java Jeopardy Writing Methods…chapter 4…
Advertisements

CSCI 1100/1202 April 3, Testing A program should be executed multiple times with various input in an attempt to find errors Debugging is the process.
Java Inheritance. What is inherited A subclass inherits variables and methods from its superclass and all of its ancestors. The subclass can use these.
Principles of Computer Programming (using Java) Chapter 10 Subclasses Haidong Xue Summer 2011, at GSU.
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.
Road Map Introduction to object oriented programming. Classes
1 Classes Overview l Classes as Types l Declaring Instance Variables l Implementing Methods l Constructors l Accessor and Mutator Methods.
Overloaded Constructors constructors can be overloaded, like other methods – i.e., a class can define several constructors all constructors must have the.
Evan Korth New York University Computer Science I Classes and Objects Professor: Evan Korth New York University.
More on Objects CS 102 More, more, more on Objects.
Evan Korth New York University Computer Science I Classes and Objects Professor: Evan Korth New York University.
Evan Korth New York University Computer Science I Classes and Objects Professor: Evan Korth New York University.
©2004 Brooks/Cole Chapter 10 More on Classes. Figures ©2004 Brooks/Cole CS 119: Intro to JavaFall 2005 Object assignment With primitive types, setting.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Composition details Recall, composition involves 3 things: –Declaration of instance variable of.
Classes in C++ Bryce Boe 2012/08/15 CS32, Summer 2012 B.
More C++ Bryce Boe 2013/07/18 CS24, Summer 2013 C.
Principles of Computer Programming (using Java) Haidong Xue Summer 2011, at GSU Copyright © 2000 W. W. Norton & Company. All rights reserved. 1.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
Classes and Class Members Chapter 3. 3 Public Interface Contract between class and its clients to fulfill certain responsibilities The client is an object.
BPJ444: Business Programming Using Java Classes and Objects Tim McKenna
1 Chapter 3 and 6– Classes, Objects and Methods Object-Oriented Programming Concepts – Read it from Java TutorialJava Tutorial Definition: A class is a.
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.
Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package.
Chapter 10 Classes and Objects: A Deeper Look Visual C# 2010 for Programmers © by Pearson Education, Inc. All Rights Reserved.
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.
ECE122 Feb. 22, Any question on Vehicle sample code?
 Classes in c++ Presentation Topic  A collection of objects with same properties and functions is known as class. A class is used to define the characteristics.
MSIS 655 Advanced Business Applications Programming Week 1 Introduction to Java
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
IFS410 Advanced Analysis and Design Week 1 Introduction to Java: Applications
Classes. Constructor A constructor is a special method whose purpose is to construct and initialize objects. Constructor name must be the same as the.
Inheritance Objectives: Creating new classes from existing classes The protected modifier Creating class hierarchies Abstract classes Indirect visibility.
1 Chapter 5: Defining Classes. 2 Basics of Classes An object is a member of a class type What is a class? Fields & Methods Types of variables: –Instance:
CIS 270—Application Development II Chapter 8—Classes and Objects: A Deeper Look.
CS 139 Objects Based on a lecture by Dr. Farzana Rahman Assistant Professor Department of Computer Science.
 Static  Example for Static Field  Example for Static Method  Math class methods  Casting  Scope of Declaration  Method Overloading  Constructor.
AP Java Ch. 4 Review Question 1  Java methods can return only primitive types (int, double, boolean, etc).
5.1 Basics of defining and using classes A review of class and object definitions A class is a template or blueprint for an object A class defines.
JAVA ACCESS MODIFIERS. Access Modifiers Access modifiers control which classes may use a feature. A classes features are: - The class itself - Its member.
Classes CS 162 (Summer 2009). Parts of a Class Instance Fields Methods.
Re-Intro to Object Oriented Programming
More About Objects and Methods
Microsoft Visual Basic 2005: Reloaded Second Edition
Chapter 3: Using Methods, Classes, and Objects
Road Map Introduction to object oriented programming. Classes
Class: Special Topics Copy Constructors Static members Friends this
Haidong Xue Summer 2011, at GSU
Haidong Xue Summer 2011, at GSU
Using local variable without initialization is an error.
HIGHLEVEL REVIEW Chapter 9 Objects and Classes
Inheritance, Polymorphism, and Interfaces. Oh My
Principles of Computer Programming (using Java) Chapter 2, Part 1
Corresponds with Chapter 7
Chapter 4 (part 2).
Implementing Classes Chapter 3.
Copy Assignment CSCE 121 J. Michael Moore.
Assessment – Java Basics: Part 1
Which best describes the relationship between classes and objects?
PreAP Computer Science Quiz Key
CIS16 Application Development and Programming using Visual Basic.net
Instance Method – CSC142 Computer Science II
NAME 436.
Object Oriented Programming
Haidong Xue Summer 2011, at GSU
Haidong Xue Summer 2011, at GSU
Copy Assignment CSCE 121.
Principles of Computer Programming (using Java) Chapter 5 Arrays
SPL – PS3 C++ Classes.
Chapter 4 Test Review First day
Presentation transcript:

Haidong Xue Summer 2011, at GSU Principles of Computer Programming (using Java) Chapter 3 Classes and Objects Haidong Xue Summer 2011, at GSU

Content Quiz2 Assignment3 Classes

Quiz 2 1:50pm – 2:00pm

Classes and Objects Object model Declare a class State, behavior Declare a class Modifier, name, body Constructor (default) Overloading, signature Declare member methods Modifiers, return type, name, parameters, body Declare member variables

Classes and Objects Use classes Create instances of classes Object variables Modifiers (on classes; on member methods or member variables) Packages Declare the package which the class belongs to Use the classes in other packages

Examples HaydonsWorld.java PersonsInCSC2310.java Data: (nothing) Actions: main(…) PersonsInCSC2310.java Data: … Actions: …