Day 11 The Last Week!.

Slides:



Advertisements
Similar presentations
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 3: Flow Control I: For Loops.
Advertisements

JAVA Revision Lecture Electronic Voting System Marina De Vos.
Based on Java Software Development, 5th Ed. By Lewis &Loftus
Written by: Dr. JJ Shepherd
Objects and Classes First Programming Concepts. 14/10/2004Lecture 1a: Introduction 2 Fundamental Concepts object class method parameter data type.
1 Classes Overview l Classes as Types l Declaring Instance Variables l Implementing Methods l Constructors l Accessor and Mutator Methods.
Objects. Strings String x = “abc”; String is a class, not a primitive x.charAt(2) is ‘b’ use name and ‘.’ and name.
CS 106 Introduction to Computer Science I 03 / 21 / 2008 Instructor: Michael Eckmann.
COMP 110 Introduction to Programming Mr. Joshua Stough October 8, 2007.
CS 106 Introduction to Computer Science I 03 / 23 / 2007 Instructor: Michael Eckmann.
Terms and Rules Professor Evan Korth New York University (All rights reserved)
1 Fall 2007ACS-1903 Chapter 6: Classes Classes and Objects Instance Fields and Methods Constructors Overloading of Methods and Constructors Scope of Instance.
Understanding class definitions – Part II –. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling Main.
1 More on Classes Overview l Overloading l The this keyword l The toString method l The equals method.
Understanding class definitions Looking inside classes.
Java Objects and Classes. 3-2 Object Oriented Programming  An OO program models the application as a world of interacting objects.  A typical Java program.
Constructors A constructor is a method that creates an object in Java. It does not return anything and it is not void. It’s only purpose is to create an.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
CSC 212 – Data Structures Lecture 12: Java Review.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
CS 106 Introduction to Computer Science I 03 / 19 / 2007 Instructor: Michael Eckmann.
Lecture # 8 Constructors Overloading. Topics We will discuss the following main topics: – Static Class Members – Overloaded Methods – Overloaded Constructors.
Chapter 3: Developing Class Methods Object-Oriented Program Development Using Java: A Class-Centered Approach.
P Chapter 2 introduces Object Oriented Programming. p OOP is a relatively new approach to programming which supports the creation of new data types and.
Agenda Object Oriented Programming Reading: Chapter 14.
Java - Classes JPatterson. What is a class? public class _Alpha { public static void main(String [] args) { } You have been using classes all year – you.
CS0007: Introduction to Computer Programming Classes: Documentation, Method Overloading, Scope, Packages, and “Finding the Classes”
Java Classes Chapter 1. 2 Chapter Contents Objects and Classes Using Methods in a Java Class References and Aliases Arguments and Parameters Defining.
1 Static Variable and Method Lecture 9 by Dr. Norazah Yusof.
Object Oriented Programming and Data Abstraction Rowan University Earl Huff.
Java Programming, Second Edition Chapter Three Using Methods, Classes, and Objects.
AP Java Ch. 4 Review Question 1  Java methods can return only primitive types (int, double, boolean, etc).
1.1: Objects and Classes msklug.weebly.com. Agenda: Attendance Let’s get started What is Java? Work Time.
Lecture 3: More on Classes Textbook: Chapter 2 Recap: –Classes vs. Objects –Q: What comes first a class or an object? –Q: Do we need a class to create.
Chapter 1 Object Orientation: Objects and Classes.
Basic Class Structure. Class vs. Object class - a template for building an object –defines the instance data that the object will hold –defines instance.
Class Definitions: The Fundamentals Chapter 6 3/30/15 & 4/2/15 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
Classes CS 162 (Summer 2009). Parts of a Class Instance Fields Methods.
 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Re-Intro to Object Oriented Programming
Objects as a programming concept
3 Introduction to Classes and Objects.
Objects as a programming concept
Java Course Review.
Java Programming: Guided Learning with Early Objects
Yanal Alahmad Java Workshop Yanal Alahmad
Intro To Classes Review
Creating Your OwnClasses
Using local variable without initialization is an error.
Methods The real power of an object-oriented programming language takes place when you start to manipulate objects. A method defines an action that allows.
Classes In C#.
CLASS DEFINITION (> 1 CONSTRUCTOR)
Initializing Arrays char [] cArray3 = {'a', 'b', 'c'};
Java Programming with BlueJ
An Introduction to Java – Part II
Classes & Objects: Examples
More on Classes and Objects
Implementing Classes Chapter 3.
Today’s topics UML Diagramming review of terms
Class Everything if Java is in a class. The class has a constructor that creates the object. public class ClassName private Field data (instance variables)
Object-Oriented Programming
Instance Method – CSC142 Computer Science II
Fundamental Programming
Announcements & Review
Dr. R Z Khan Handout-3 Classes
Agenda Warmup Lesson 2.2 (parameters, etc)
Methods/Functions.
Corresponds with Chapter 5
Chapter 4 Test Review First day
Presentation transcript:

Day 11 The Last Week!

Review Data types: Java supplied: Color, String, int, double, boolean Programmer created: Day, Rectangle, Car, Picture

Review: Object Oriented Programming Instantiate objects: (example) Car mazda = new Car(25); Methods: use the dot operator on an object to call a method Signature: Public (sometimes private), return type, name, parameter in parenthesis: public void drive(double distance) Accessors: int currentYear=day1.getYear(); Mutators: rectangle1.translate(5,10); (Note: the return type is void) Constructors: No return type & requires new operator, see example above

Review--Variables Parameters: Passed into methods and are in the parentheses. Instance variable: private, at the top of a class Local variables: used in a method to make a calculation. Declare once by stating type Scope

Review--Design Pseudocode helps to create algorithms: calculation, repetition, decision Designing classes: Documentation helps to read others’ classes Create a plan for the methods, their signatures (1st lines) and the instance variables Test the classes directly through BlueJ or write a TesterClass with a main method

Review Loops Initialize, increment & test While loop For loop

Review--decisions if, if – else, if - else if - else Relational operators Logical operators

Social Network Person Class

Nim Game

Rock, Paper, Scissors