Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS102--Object Oriented Programming Review 1: Chapter 1 – Chapter 7 Copyright © 2008 Xiaoyan Li.

Similar presentations


Presentation on theme: "CS102--Object Oriented Programming Review 1: Chapter 1 – Chapter 7 Copyright © 2008 Xiaoyan Li."— Presentation transcript:

1 CS102--Object Oriented Programming Review 1: Chapter 1 – Chapter 7 Copyright © 2008 Xiaoyan Li

2 Chapter 1: Introduction Important terms/concepts: – Algorithm, program – High level language, machine language, low level language – Compiler, interpreter, byte-code, the Java virtual machine – Class, object – Method, function, – Code, source code, object code Java programs: applications and applets A simple java program, (System.out.println) Variable declaration, primitive types, constants Type casting The class String

3 Chapter 2: console input/output System.out.println System.out.print System.out.printf the Scanner class

4 Chapter 3: Flow of Control If, if-else, An multiway if-else statement switch for, while, do-while

5 Chapter 4&5: Defining Classes public class MyClass { //instance variables //methods //1. constructors: regular one and a copy constructor (deep copy) //2. accessor methods/getters //3. mutator methods/setters //4. toString() method //5. equals method //6. other helping methods //optional main method for testing }

6 Chapter 4&5: Defining Classes The new operator The this parameter public, private, static, final primitive variables vs. class variables ==, equals, deep copy

7 Chapter 6: Arrays Array variables Multi-dimensional arrays Array objects in java, the length variable Sort an array/Selection sort Access array elements Compare two arrays The class Arrays

8 Chapter 7: Inheritance 1. What are base classes and derived classes? 2. What are parent classes and child classes? 3. Which members of based classes are inherited? 4. What is method overloading? 5. What is method overriding? 6. Can you change the return type of a overridden method? 7. Can you change the access permission of a overridden method? 7. What is super constructor and when to use it? 8. What is this constructor and when to use it? 9. When do you use the final modifier? 10. public, protected, package, private 11. the Object class 12. getClass() vs. instanceOf operator

9 Sample Questions for Midterm True or false – An instance variable (or method) that is private in a base class is accessible by name in the definition of a method in any other class. Short Answers – Explain how parent and child classes are related to base and derived classes. – Write a method print out all elements in an array of integers

10 Announcements Programming Assignment4: – Page 465: project 5 – Due date: March 27 In-class midterm: – Date: Wednesday (March 12th) – Topics (Ch1 – Ch7)


Download ppt "CS102--Object Oriented Programming Review 1: Chapter 1 – Chapter 7 Copyright © 2008 Xiaoyan Li."

Similar presentations


Ads by Google