CS : Data Structures

Size: px
Start display at page:

Download "CS : Data Structures"

Transcription

1 CS : Data Structures Michael Schatz Oct 3, 2016 Lecture 14: Machine Code Optimization

2 Assignment 5: Due Sunday Oct 10pm Remember: javac Xlint:all & checkstyle *.java & JUnit Solutions should be independently written!

3 Part 1: Machine Code Optimization

4 Intel Instruction Set Note: modern processors have hundreds of instructions

5 Intro to machine code compiler assembler

6 Java bytecode instructions

7 Java bytecode instructions

8 Reverse Engineering Bytecode $ od -x Mystery.class feca beba c00 000a c f a00 1d00 1e f a c a a a a a a 2b c c e 3e f f00 694c 656e 754e 626d c d 6e c5b a c2f 6e61 2f e b a00 6f c e e 6a2e c c2d 2e00 2f c a f61 616c e 532f e c a 000c c a69 0c b69 3a31 0c c39 3a b e a f61 616c 676e 4f2f 6a e00 616a c2f 6e61 2f67 614d f a f61 616c 676e 532f d f a4c f61 6f69 502f e d b e d 6a4c f61 616c 676e 532f e69 3b c29 616a c2f 6e61 2f e c b c a4c f61 616c 676e 532f e c b 1c c29

9 Reverse Engineering Bytecode $ od -x Mystery.class feca beba c00 000a c f a00 1d00 1e f a c a a a a a a 2b c c e 3e f f00 694c 656e 754e 626d c d 6e c5b a c2f 6e61 2f e b a00 6f c e e 6a2e c c2d 2e00 2f c a f61 616c Just Kidding J e 532f e c a 000c c a69 0c b69 3a31 0c c39 3a b e a f61 616c 676e 4f2f 6a e00 616a c2f 6e61 2f67 614d f a f61 616c 676e 532f d f a4c f61 6f69 502f e d b e d 6a4c f61 616c 676e 532f e69 3b c29 616a c2f 6e61 2f e c b c a4c f61 616c 676e 532f e c b 1c c29

10 Midterm Review

11 Part 1: Inheritance

12 Why Inheritance? Code Reuse Subclass gets to use all methods of the parent class for free Overriding Subclass can have more specific implementation than the parent class Design constraints Subclasses get all of the features of the parent, whether you like them or not! Saying B inherits from A is a very strong relationship: anytime that A could be used, B could be instead

13 Inheritance Types Single Inheritance Multilevel Inheritance Multiple Inheritance B isa A C isa B, B isa A C isa A, C isa B Square isa Rectangle Square isa Rectangle Rectangle isa Shape => Square isa Shape Does Java support multiple inheritance? Sort of, a class can implement multiple interfaces Mike isa CS Prof Mike isa Bio Prof

14 Inheritance versus Encapsulation Pokemon Trainer Position pos String name Should a ListStack inherit from Stack? String team Yep, a ListStack List<Pokemon> ISA Stack! List<Eggs> Backpack pack Position Double lat Double long Double altitude Backpack Int capacity List<Items> items Should a PokemonTrainer inherit from List? B isa A Nah, you wouldn t use a PokemonTrainer in all places that you would use a Square isa List, use encapsulation Trainer instead hasa Position, Rectangle Trainer hasa Backpack, etc Encapsulation is used to hide the values or state of a structured data object inside a class,

15 Part 2: Java Features

16 Primitive Data Types The 8 primitive data types supported by the Java programming language are: 1. byte: 8-bit signed two's complement integer: [-128, 127] 2. short: 16-bit signed two's complement integer: [-32,768, 32,767] 3. int: 32-bit signed two's complement integer: [-2 31, ] 4. long: 64-bit two's complement integer: [-2 63, ] 5. float: Single-precision 32-bit IEEE 754 floating point. Good for saving memory in large arrays of values. 6. double: Double-precision 64-bit IEEE 754 floating point. Default choice for decimal values 7. boolean: Two possible values: true and false. This data type represents one bit of information, but its "size" isn't something that's precisely defined. 8. char: The char data type is a single 16-bit Unicode character. Everything else is an Object Note there is an Object version of each primitive data type and Java will try to convert back and forth when you need it: int ó Integer, float ó Float, etc

17 Classes & Objects All java code must be in some class (and inside some package) (If no package name is listed, code goes into unnamed package) This helps organize code, and avoids naming conflicts: if your code defines a method print, and my code defines a method print specifying the class (and package) will clarify which one you mean However, we don t always want nor need an object to call a method: class MathStuff { public int max3(int a, int b, int c) { MathStuff stuff = new MathStuff(); int biggest = stuff.max3(42,14,99); Use the static keyword to tell the compiler that it is okay to call this method directly (without an object): class MathStuff { public static int max3(int a, int b, int c) { int biggest = MathStuff.max3(42,14,99);

18 Variables Instance Variables (Non-Static Fields) Values are unique to each instance of a class (to each object) Class Variables (Static Fields) Tells the compiler that there is exactly one copy of this variable in existence, regardless of how many times the class has been instantiated. Local Variables Similar to how an object stores its state in fields, a method can store its temporary state in local variables. Local variables are only visible to the methods in which they are declared Parameters Similar to local variables, although are passed in from other calling methods. Final Variables Final means the value can only be set once

19 Variables Instance Variables (Non-Static Fields) Values are unique to each instance of a class (to each object) Class Variables (Static Fields) Tells the compiler that there is exactly one copy of this variable in existence, regardless of how many times the class has been instantiated. Local Variables Similar to how an object stores its state in fields, a method can store its temporary state in local variables. Local variables are only visible to the methods in which they are declared Parameters Similar to local variables, although are passed in from other calling methods. Final Variables Final means How should the value you can store only the be currentspeed set once in a Bicycle class? How should you store Pi in a Math class?

20 Controlling Access Use access level modifiers to restrict access to methods and member variables (enforced by the compiler and JRE!) Access levels affect you in two ways: When you use classes that come from another source, such as the classes in the Java platform, access levels determine which members of those classes your own classes can use. When you write a class, you need to decide what access level every member variable and every method in your class should have.

21 Controlling Access Use access level modifiers to restrict access to methods and member variables (enforced by the compiler and JRE!) Access levels affect you in two ways: When you use classes that come from another source, such as the classes in Should the Java you platform, make all access your methods levels determine and fields which public? members of those classes your own classes can use. When No you way! write Try a class, to make you need access to decide as restricted what access as possible! level every member variable and every method in your class should have.

22 Nested Classes The Java programming language allows you to define a class within another class, a nested class class OuterClass {... class NestedClass {... Nested classes are divided into two categories: static and non-static. Nested classes that are declared static are called static nested classes. Non-static nested classes are called inner classes. class OuterClass {... static class StaticNestedClass {... class InnerClass {...

23 Nested Classes The Java programming language allows you to define a class within another class, a nested class A nested class is a member of its enclosing class. As a member class OuterClass of the OuterClass, { a nested class can be declared private, public, protected,... or package private. class NestedClass {... Static nested classes do not have access to other members of the enclosing class. Like static methods, you would have to pass in an object reference Nested classes are divided into two categories: static and non-static. Nested classes that Non-static are declared nested static classes are called (inner static classes) nested classes. have Non-static access to nested other classes are called members inner of classes. the enclosing class, even if they are declared private. An instance of InnerClass can exist only within an instance of OuterClass class OuterClass {... static class StaticNestedClass {... class InnerClass {...

24 Introduction to Java Interfaces Objects define their interaction with the outside world through the methods that they expose. Methods form the object's interface with the outside world; the buttons on the front of your television set, for example, are the interface between you and the electrical wiring on the other side of its plastic casing. You press the "power" button to turn the television on and off. [ ] An interface is a group of related methods with empty bodies. interface Counter { int value(); void up(); void down(); + - specification: Counter has an integer value + button increments by 1 - button decrements by 1 Specification can be a separate documents or in the javadoc comments

25 Abstract Classes Abstract classes are analogous to interfaces, but with a partial implementation. An abstract class is a class that is declared abstract it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed. An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon), like this: abstract void moveto(double deltax, double deltay); If a class includes abstract methods, then the class itself must be declared abstract, as in: public abstract class GraphicObject { // declare fields int x, y; // declare nonabstract methods abstract void draw();

26 Abstract Classes Consider An abstract using class abstract is a class classes that is if declared any of these abstract it statements may or apply may to not your include abstract methods. Abstract classes cannot be instantiated, but they situation: can be subclassed. You want to share code among several closely related classes. You expect that classes that extend your abstract class have many common An methods abstract or fields, method or is require a method access that modifiers is declared other without than public an implementation (such as (without braces, and followed by a semicolon), like this: protected and private). You want to declare non-static or non-final fields. This enables you to define methods abstract that can void access moveto(double and modify the deltax, state double of the object deltay); to which they belong. If a class includes abstract methods, then the class itself must be declared Consider abstract, using as in: interfaces if any of these statements apply to your situation: You public expect abstract that unrelated class GraphicObject classes would { implement your interface. For example, the // declare interfaces fields Comparable and Cloneable are implemented by many unrelated classes. // declare nonabstract methods You want to abstract specify void the behavior draw(); of a particular data type, but not concerned about who implements its behavior. You want to take advantage of multiple inheritance of type.

27 Java Generics Generics enable types (classes and interfaces) to be parameters when defining classes, interfaces and methods. Much like the more familiar formal parameters used in method declarations, type parameters provide a way for you to re-use the same code with different inputs. The difference is that the inputs to formal parameters are values, while the inputs to type parameters are types. Code that uses generics has many benefits over non-generic code: Stronger type checks at compile time. A Java compiler applies strong type checking to generic code and issues errors if the code violates type safety. Fixing compile-time errors is easier than fixing runtime errors, which can be difficult to find. Elimination of casts. The following code snippet without generics requires casting: List list = new ArrayList(); list.add("hello"); String s = (String) list.get(0); When re-written to use generics, the code does not require casting: List<String> list = new ArrayList<String>(); list.add("hello"); String s = list.get(0); // no cast Enabling programmers to implement generic algorithms. By using generics, programmers can implement generic algorithms that work on collections of different types, can be customized, and are type safe and easier to read.

28 Java Generics Generics enable types (classes and interfaces) to be parameters when defining classes, interfaces and methods. Much like the more familiar formal parameters used in method declarations, type parameters provide a way for you to re-use the same code with different inputs. The difference is that the inputs to formal parameters are values, while the inputs to type parameters are types. Code that uses generics has many benefits over non-generic code: Stronger type checks at compile time. A Java compiler applies strong type checking to generic code and issues errors if the code violates type safety. Fixing compile-time errors is easier than fixing runtime errors, which can be difficult to find. Elimination of casts. The following code snippet without generics requires casting: List list = new ArrayList(); list.add("hello"); String s = (String) list.get(0); When re-written to use generics, the code does not require casting: List<String> list = new ArrayList<String>(); list.add("hello"); String s = list.get(0); // no cast Enabling programmers to implement generic algorithms. By using generics, programmers can implement generic algorithms that work on collections of different types, can be customized, and are type safe and easier to read.

29 Part 4: Make Lists Useful Again J

30 List Queue insertfront insertback addme.next = first; first = addme; last.next = addme; addme.next = null removefront removeback first = first.next;???

31 List v4 List l = new List<String>(); Position a = l.insertfront( Mike ); Position b = l.insertback( Peter ); Position c = l.insertfront( Kelly ); l.removeat(a); public interface Position<T> { // empty on purpose public interface List<T> { // simplified interface int length(); Position<T> insertfront(t t); Position<T> insertback(t t); // TODO: void is temporary void removeat(position<t> p); b a c List front Node Kelly next prev Node Mike next prev This interface protects the integrity of the List, but is weird in that we can have references Node to objects but cant get their value or do anything else with them except remove Peter them null next prev back null

32 List v5 public interface Position<T> { T get(); void put(t t); Hooray, now we can get/set the value from a Position public interface List<T> { private static class Node<T> implements Position<T> { Node<T> next; Node<T> prev; T data; List<T> color; public T get() { return this.data; public void put(t t) { this.data = t;... Why wouldn t you want to do it this way? What if you wanted a UniqueList<T> that only stored unique items? This would have to be checked in the UniqueList<T> implementation

33 List v6 public interface List<T> {... Position<T> front() throws EmptyListException; Position<T> back() throws EmptyListException; Position<T> next(position<t> p) throws InvalidPositionException; Position<T> previous(position<t> p) throws InvalidPositionException; boolean hasnext(position<t> p) throws InvalidPositionException; boolean hasprevious(position<t> p) throws InvalidPositionException; Why do we put next() and prev() into the list and not Position? boolean valid(position<t> p); For more complex data structures, like trees or graphs, next() and prev() will be more complicated

34 Iterator Interface public interface Iterator<T> { boolean valid(); void next(); // next element, not necessarily next T get(); // get ok, but put may break invariants public interface List<T> {... Iterator<T> forwarditerator(); Iterator<T> backwarditerator();... Iterator<String> i = list.forwarditerator(); while (i.valid()) { String e = i.get(); // do whatever with the element e i.next();

35 Iterator Interface private static class NodeListIterator<T> implements Iterator<T> { private Node<T> current; private boolean forward; NodeListIterator(Node<T> start, boolean forward) { this.current = start; Ternary operator: this.forward = forward; If (this.forward) { public boolean valid() { this.current = this.current.next; return this.current!= else null; { this.current = this.current.prev; public void next() { this.current = this.forward? this.current.next : this.current.prev; public T get() { return this.current.get();

36 Iterator Interface public Iterator<T> forwarditerator() { return new NodeListIterator<T>(this.front, true); public Iterator<T> backwarditerator() { return new NodeListIterator<T>(this.back, public void testforwarditerator() { list.insertback("peter"); list.insertback("paul"); list.insertback("mary"); String[] expected = {"Peter", "Paul", "Mary"; int current = 0; Iterator<String> i = list.forwarditerator(); while (i.valid()) { String e = i.get(); assertequals(expected[current], e); i.next(); current += 1; assertequals(3, current);

37 Iterator Interface public Iterator<T> forwarditerator() { return new NodeListIterator<T>(this.front, true); public Iterator<T> backwarditerator() { return new NodeListIterator<T>(this.back, public void testbackwarditerator() { list.insertback("peter"); list.insertback("paul"); list.insertback("mary"); String[] expected = {"Mary", "Paul", "Peter"; int current = 0; Iterator<String> i = list.backwarditerator(); while (i.valid()) { String e = i.get(); assertequals(expected[current], e); i.next(); current += 1; assertequals(3, current);

38 List v7 public interface List<T> extends Iterable<T> {... private static class NodeListIterator<T> implements Iterator<T> {... Iterator<String> i = list.iterator(); while (i.hasnext()) { String e = i.next(); // do something with element e for (String e: list) { // do something with element e

39 Living in a null world List List Node front null front Mike next prev null back back null List Node Node front Mike next prev Peter next prev null back null

40 Living in a null world public Position <T> insertback(t t) {... if (this.back List!= null) { List Node this.back.next = n; public Position <T> insertfront(t t ) {... if (this.front == null) { Mike null if (this.front!= null) { this.front front = n; null this.front.prev next =n; prev... if (this.back==null) { this.back null = n; back back... List Node Node public void removeat(position<t> p) { Mike Peter null... if (n.next front!= null) next { n.next.prev next = n.prev; if (n.prev!= null) prev { n.prev.next = n.next;... null back

41 Doubly Linked List with Sentinels List Node Node first f next prev b next prev null last null

42 Doubly Linked List with Sentinels List Node Node Node first f next prev 1 next prev b next prev null last null

43 Doubly Linked List with Sentinels List Node Node Node Node first f next prev 1 next prev 2 next prev b next prev null last null For the cost of a tiny bit of extra memory, the code gets significantly simpler!

44 Part 4: Midterm Review!

45 Next Steps 1. Reflect on the magic and power of Sentinels! 2. Work on Assignment 5: Due Sunday Oct 10:00 pm 3. Start to review for Midterm on Monday Oct Your notes from class 2. Lecture Notes on Piazza 3. Slides on course webpage 4. Online & printed textbooks 5. Sample Midterm!!!

46 Welcome to CS Questions?

CS : Data Structures

CS : Data Structures CS 600.226: Data Structures Michael Schatz Oct 3, 2016 Lecture 13: More Lists Assignment 4: Due Sunday Oct 2 @ 10pm Remember: javac Xlint:all & checkstyle *.java & JUnit Solutions should be independently

More information

CS : Data Structures

CS : Data Structures CS 600.226: Data Structures Michael Schatz Oct 7, 2016 Lecture 15: More Machine Code Optimization ;-) Assignment 5: Due Sunday Oct 9 @ 10pm Remember: javac Xlint:all & checkstyle *.java & JUnit Solutions

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

CS : Data Structures Michael Schatz. Sept Lecture 5: Iterators

CS : Data Structures Michael Schatz. Sept Lecture 5: Iterators CS 600.226: Data Structures Michael Schatz Sept 10 2018 Lecture 5: Iterators Agenda 1. Review HW1 2. References and Linked Lists 3. Nested Classes and Iterators Assignment 1: Due Friday Sept 14 @ 10pm

More information

CS : Data Structures

CS : Data Structures CS 600.226: Data Structures Michael Schatz Oct 14, 2016 Lecture 18: Tree Implementation Assignment 5: Due Sunday Oct 9 @ 10pm Remember: javac Xlint:all & checkstyle *.java & JUnit Solutions should be independently

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

CS : Data Structures Michael Schatz. Sept 5, 2018 Lecture 3: Introduction to Interfaces

CS : Data Structures Michael Schatz. Sept 5, 2018 Lecture 3: Introduction to Interfaces CS 600.226: Data Structures Michael Schatz Sept 5, 2018 Lecture 3: Introduction to Interfaces Agenda 1. Quick Review 2. Introduction to Java Interfaces 3. Introduction to Generics, Exceptions and Arrays

More information

CS : Data Structures

CS : Data Structures CS 600.226: Data Structures Michael Schatz Oct 17, 2016 Lecture 19: Trees and Graphs Assignment 6: Due Sunday Oct 23 @ 10pm Remember: javac Xlint:all & checkstyle *.java & JUnit Solutions should be independently

More information

CS260 Intro to Java & Android 03.Java Language Basics

CS260 Intro to Java & Android 03.Java Language Basics 03.Java Language Basics http://www.tutorialspoint.com/java/index.htm CS260 - Intro to Java & Android 1 What is the distinction between fields and variables? Java has the following kinds of variables: Instance

More information

S.E. Sem. III [CMPN] Object Oriented Programming Methodology

S.E. Sem. III [CMPN] Object Oriented Programming Methodology S.E. Sem. III [CMPN] Object Oriented Programming Methodology Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 80 Q.1(a) Write a program to calculate GCD of two numbers in java. [5] (A) import java.util.*;

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

CS 231 Data Structures and Algorithms, Fall 2016

CS 231 Data Structures and Algorithms, Fall 2016 CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard

More information

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003 Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Object-Oriented Programming Intro Department of Computer Science University of Maryland, College Park Object-Oriented Programming (OOP) Approach to improving software

More information

CS : Data Structures

CS : Data Structures CS 600.226: Data Structures Michael Schatz Sept 21, 2016 Lecture 8: Sorting Assignment 3: Due Sunday Sept 25 @ 10pm Remember: javac Xlint:all & checkstyle *.java Solutions should be independently written!

More information

1 Shyam sir JAVA Notes

1 Shyam sir JAVA Notes 1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write

More information

Data Structure. Recitation IV

Data Structure. Recitation IV Data Structure Recitation IV Topic Java Generics Java error handling Stack Lab 2 Java Generics The following code snippet without generics requires casting: List list = new ArrayList(); list.add("hello");

More information

CS : Data Structures

CS : Data Structures CS 600.226: Data Structures Michael Schatz Oct 20, 2016 Lecture 21: Graphs and Sets Assignment 6: Due Monday Oct 24 @ 10pm Remember: javac Xlint:all & checkstyle *.java & JUnit Solutions should be independently

More information

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Object oriented programming. Instructor: Masoud Asghari Web page:   Ch: 3 Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning

More information

Another IS-A Relationship

Another IS-A Relationship Another IS-A Relationship Not all classes share a vertical relationship. Instead, some are supposed to perform the specific methods without a vertical relationship. Consider the class Bird inherited from

More information

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program

More information

CS231 - Spring 2017 Linked Lists. ArrayList is an implementation of List based on arrays. LinkedList is an implementation of List based on nodes.

CS231 - Spring 2017 Linked Lists. ArrayList is an implementation of List based on arrays. LinkedList is an implementation of List based on nodes. CS231 - Spring 2017 Linked Lists List o Data structure which stores a fixed-size sequential collection of elements of the same type. o We've already seen two ways that you can store data in lists in Java.

More information

Index COPYRIGHTED MATERIAL

Index COPYRIGHTED MATERIAL Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes

More information

CS : Data Structures

CS : Data Structures CS 600.226: Data Structures Michael Schatz Sept 23, 2016 Lecture 9: Stacks Assignment 3: Due Sunday Sept 25 @ 10pm Remember: javac Xlint:all & checkstyle *.java & JUnit Solutions should be independently

More information

Converting Collections to Arrays. A Bad Approach to Array Conversion. A Better Approach to Array Conversion. public Object[] toarray();

Converting Collections to Arrays. A Bad Approach to Array Conversion. A Better Approach to Array Conversion. public Object[] toarray(); Converting Collections to Arrays Every Java collection can be converted to an array This is part of the basic Collection interface The most elementary form of this method produces an array of base-type

More information

Chapter 6 Introduction to Defining Classes

Chapter 6 Introduction to Defining Classes Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of

More information

CS : Data Structures

CS : Data Structures CS 600.226: Data Structures Michael Schatz Oct 12, 2016 Lecture 17: Trees Assignment 5: Due Sunday Oct 9 @ 10pm Remember: javac Xlint:all & checkstyle *.java & JUnit Solutions should be independently written!

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 2 Things to Review Review the Class Slides: Key Things to Take Away Do you understand

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

CS 11 java track: lecture 1

CS 11 java track: lecture 1 CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml

More information

CS : Data Structures Michael Schatz. Oct 15, 2018 Lecture 20. Sets

CS : Data Structures Michael Schatz. Oct 15, 2018 Lecture 20. Sets CS 600.226: Data Structures Michael Schatz Oct 15, 2018 Lecture 20. Sets Agenda 1. Recap on Graphs 2. Sets Part 1:Graphs Graphs are Everywhere! Computers in a network, Friends on Facebook, Roads & Cities

More information

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple

More information

Introduction to Linked Lists

Introduction to Linked Lists Introduction to Linked Lists In your previous programming course, you organized and processed data items sequentially using an array (or possibly an arraylist, or a vector). You probably performed several

More information

CS : Data Structures Michael Schatz. Oct 22, 2018 Lecture 22. Ordered Sets

CS : Data Structures Michael Schatz. Oct 22, 2018 Lecture 22. Ordered Sets CS 600.226: Data Structures Michael Schatz Oct 22, 2018 Lecture 22. Ordered Sets HW5 Assignment 5: Six Degrees of Awesome Out on: October 17, 2018 Due by: October 26, 2018 before 10:00 pm Collaboration:

More information

A final method is a method which cannot be overridden by subclasses. A class that is declared final cannot be inherited.

A final method is a method which cannot be overridden by subclasses. A class that is declared final cannot be inherited. final A final variable is a variable which can be initialized once and cannot be changed later. The compiler makes sure that you can do it only once. A final variable is often declared with static keyword

More information

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring

More information

CS : Data Structures

CS : Data Structures CS 600.226: Data Structures Michael Schatz Sept 7, 2016 Lecture 2: Introduction to Interfaces Course Webpage: Course Discussions: Welcome! http://www.cs.jhu.edu/~cs226/ http://piazza.com Office Hours:

More information

Review for Test 1 (Chapter 1-5)

Review for Test 1 (Chapter 1-5) Review for Test 1 (Chapter 1-5) 1. Introduction to Computers, Programs, and Java a) What is a computer? b) What is a computer program? c) A bit is a binary digit 0 or 1. A byte is a sequence of 8 bits.

More information

Inheritance and Interfaces

Inheritance and Interfaces Inheritance and Interfaces Object Orientated Programming in Java Benjamin Kenwright Outline Review What is Inheritance? Why we need Inheritance? Syntax, Formatting,.. What is an Interface? Today s Practical

More information

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment

More information

Java Bytecode (binary file)

Java Bytecode (binary file) Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.

More information

CSE 331 Software Design and Implementation. Lecture 14 Generics 2

CSE 331 Software Design and Implementation. Lecture 14 Generics 2 CSE 331 Software Design and Implementation Lecture 14 Generics 2 Zach Tatlock / Spring 2018 Big picture Last time: Generics intro Subtyping and Generics Using bounds for more flexible subtyping Using wildcards

More information

CSE 331 Software Design and Implementation. Lecture 14 Generics 2

CSE 331 Software Design and Implementation. Lecture 14 Generics 2 CSE 331 Software Design and Implementation Lecture 14 Generics 2 James Wilcox / Winter 2016 Hi, I m James! Big picture Last time: Generics intro Subtyping and Generics Using bounds for more flexible subtyping

More information

Interfaces. An interface forms a contract between the object and the outside world.

Interfaces. An interface forms a contract between the object and the outside world. Interfaces An interface forms a contract between the object and the outside world. For example, the buttons on the television set are the interface between you and the electrical wiring on the other side

More information

Lecture 8: Iterators and More Mutation

Lecture 8: Iterators and More Mutation Integrated Introduction to Computer Science Fisler, Nelson Contents 1 Traversing Lists 1 2 Motivating Iterators 2 3 Writing an Iterator 3 4 Writing Sum with an Iterator 4 Objectives By the end of this

More information

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find CS1622 Lecture 15 Semantic Analysis CS 1622 Lecture 15 1 Semantic Analysis How to build symbol tables How to use them to find multiply-declared and undeclared variables. How to perform type checking CS

More information

CS 251 Intermediate Programming Methods and Classes

CS 251 Intermediate Programming Methods and Classes CS 251 Intermediate Programming Methods and Classes Brooke Chenoweth University of New Mexico Fall 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

CS 251 Intermediate Programming Java Basics

CS 251 Intermediate Programming Java Basics CS 251 Intermediate Programming Java Basics Brooke Chenoweth University of New Mexico Spring 2018 Prerequisites These are the topics that I assume that you have already seen: Variables Boolean expressions

More information

CS 251 Intermediate Programming Methods and More

CS 251 Intermediate Programming Methods and More CS 251 Intermediate Programming Methods and More Brooke Chenoweth University of New Mexico Spring 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

Language Fundamentals Summary

Language Fundamentals Summary Language Fundamentals Summary Claudia Niederée, Joachim W. Schmidt, Michael Skusa Software Systems Institute Object-oriented Analysis and Design 1999/2000 c.niederee@tu-harburg.de http://www.sts.tu-harburg.de

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting

More information

Sri Vidya College of Engineering & Technology

Sri Vidya College of Engineering & Technology UNIT I INTRODUCTION TO OOP AND FUNDAMENTALS OF JAVA 1. Define OOP. Part A Object-Oriented Programming (OOP) is a methodology or paradigm to design a program using classes and objects. It simplifies the

More information

Declarations and Access Control SCJP tips

Declarations and Access Control  SCJP tips Declarations and Access Control www.techfaq360.com SCJP tips Write code that declares, constructs, and initializes arrays of any base type using any of the permitted forms both for declaration and for

More information

Midterm Exam CS 251, Intermediate Programming March 12, 2014

Midterm Exam CS 251, Intermediate Programming March 12, 2014 Midterm Exam CS 251, Intermediate Programming March 12, 2014 Name: NetID: Answer all questions in the space provided. Write clearly and legibly, you will not get credit for illegible or incomprehensible

More information

Programming overview

Programming overview Programming overview Basic Java A Java program consists of: One or more classes A class contains one or more methods A method contains program statements Each class in a separate file MyClass defined in

More information

CSE 143 Lecture 26. Advanced collection classes. (ADTs; abstract classes; inner classes; generics; iterators) read 11.1, 9.6, ,

CSE 143 Lecture 26. Advanced collection classes. (ADTs; abstract classes; inner classes; generics; iterators) read 11.1, 9.6, , CSE 143 Lecture 26 Advanced collection classes (ADTs; abstract classes; inner classes; generics; iterators) read 11.1, 9.6, 15.3-15.4, 16.4-16.5 slides created by Marty Stepp, adapted by Alyssa Harding

More information

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17 List of Programs xxv List of Figures xxix List of Tables xxxiii Preface to second version xxxv PART 1 Structured Programming 1 1 Getting started 3 1.1 Programming 3 1.2 Editing source code 5 Source code

More information

Timing for Interfaces and Abstract Classes

Timing for Interfaces and Abstract Classes Timing for Interfaces and Abstract Classes Consider using abstract classes if you want to: share code among several closely related classes declare non-static or non-final fields Consider using interfaces

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

Homework 2: Imperative Due: 5:00 PM, Feb 15, 2019

Homework 2: Imperative Due: 5:00 PM, Feb 15, 2019 CS18 Integrated Introduction to Computer Science Fisler Homework 2: Imperative Due: 5:00 PM, Feb 15, 2019 Contents 1 Overview of Generic/Parameterized Types 2 2 Double the Fun with Doubly-Linked Lists

More information

Super-Classes and sub-classes

Super-Classes and sub-classes Super-Classes and sub-classes Subclasses. Overriding Methods Subclass Constructors Inheritance Hierarchies Polymorphism Casting 1 Subclasses: Often you want to write a class that is a special case of an

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 43 Dynamic Binding (Polymorphism): Part III Welcome to Module

More information

Java Primer. CITS2200 Data Structures and Algorithms. Topic 2

Java Primer. CITS2200 Data Structures and Algorithms. Topic 2 CITS2200 Data Structures and Algorithms Topic 2 Java Primer Review of Java basics Primitive vs Reference Types Classes and Objects Class Hierarchies Interfaces Exceptions Reading: Lambert and Osborne,

More information

Object-Oriented Software Engineering. Chapter 2: Review of Object Orientation

Object-Oriented Software Engineering. Chapter 2: Review of Object Orientation Object-Oriented Software Engineering Chapter 2: Review of Object Orientation 2.1 What is Object Orientation? Procedural paradigm: Software is organized around the notion of procedures Procedural abstraction

More information

What is an Iterator? An iterator is an abstract data type that allows us to iterate through the elements of a collection one by one

What is an Iterator? An iterator is an abstract data type that allows us to iterate through the elements of a collection one by one Iterators What is an Iterator? An iterator is an abstract data type that allows us to iterate through the elements of a collection one by one 9-2 2-2 What is an Iterator? An iterator is an abstract data

More information

Collections and Iterators. Collections

Collections and Iterators. Collections Collections and Iterators Based on the notes from David Fernandez-Baca and Steve Kautz Based on The Java Tutorial (http://docs.oracle.com/javase/tutorial/java/) Bryn Mawr College CS206 Intro to Data Structures

More information

Defining Classes and Methods

Defining Classes and Methods Defining Classes and Methods Chapter 5 Modified by James O Reilly Class and Method Definitions OOP- Object Oriented Programming Big Ideas: Group data and related functions (methods) into Objects (Encapsulation)

More information

Java Primer 1: Types, Classes and Operators

Java Primer 1: Types, Classes and Operators Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,

More information

CS1004: Intro to CS in Java, Spring 2005

CS1004: Intro to CS in Java, Spring 2005 CS1004: Intro to CS in Java, Spring 2005 Lecture #16: Java conditionals/loops, cont d. Janak J Parekh janak@cs.columbia.edu Administrivia Midterms returned now Weird distribution Mean: 35.4 ± 8.4 What

More information

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda

More information

CSC 172 Data Structures and Algorithms. Lecture 3 Spring 2018 TuTh 3:25 pm 4:40 pm

CSC 172 Data Structures and Algorithms. Lecture 3 Spring 2018 TuTh 3:25 pm 4:40 pm CSC 172 Data Structures and Algorithms Lecture 3 Spring 2018 TuTh 3:25 pm 4:40 pm Agenda Administrative aspects Java Generics Chapter 1 ADMINISTRATIVE ASPECTS Workshops Workshops Workshops begin on this

More information

Type Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004

Type Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004 Type Hierarchy Comp-303 : Programming Techniques Lecture 9 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 9 Comp 303 : Programming Techniques Page 1 Last lecture...

More information

Wrapper Classes double pi = new Double(3.14); 3 double pi = new Double("3.14"); 4... Zheng-Liang Lu Java Programming 290 / 321

Wrapper Classes double pi = new Double(3.14); 3 double pi = new Double(3.14); 4... Zheng-Liang Lu Java Programming 290 / 321 Wrapper Classes To treat values as objects, Java supplies standard wrapper classes for each primitive type. For example, you can construct a wrapper object from a primitive value or from a string representation

More information

Advanced Programming - JAVA Lecture 4 OOP Concepts in JAVA PART II

Advanced Programming - JAVA Lecture 4 OOP Concepts in JAVA PART II Advanced Programming - JAVA Lecture 4 OOP Concepts in JAVA PART II Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Ad hoc-polymorphism Outline Method overloading Sub-type Polymorphism Method overriding Dynamic

More information

Classes, interfaces, & documentation. Review of basic building blocks

Classes, interfaces, & documentation. Review of basic building blocks Classes, interfaces, & documentation Review of basic building blocks Objects Data structures literally, storage containers for data constitute object knowledge or state Operations an object can perform

More information

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation

More information

+ Abstract Data Types

+ Abstract Data Types Linked Lists Abstract Data Types An Abstract Data Type (ADT) is: a set of values a set of operations Sounds familiar, right? I gave a similar definition for a data structure. Abstract Data Types Abstract

More information

Synchronization SPL/2010 SPL/20 1

Synchronization SPL/2010 SPL/20 1 Synchronization 1 Overview synchronization mechanisms in modern RTEs concurrency issues places where synchronization is needed structural ways (design patterns) for exclusive access 2 Overview synchronization

More information

Lecture 2: Java & Javadoc

Lecture 2: Java & Javadoc Lecture 2: Java & Javadoc CS 62 Fall 2018 Alexandra Papoutsaki & William Devanny 1 Instance Variables or member variables or fields Declared in a class, but outside of any method, constructor or block

More information

CS121/IS223. Object Reference Variables. Dr Olly Gotel

CS121/IS223. Object Reference Variables. Dr Olly Gotel CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors CS121/IS223

More information

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8 Epic Test Review 1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4 Write a line of code that outputs the phase Hello World to the console without creating a new line character. System.out.print(

More information

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully

More information

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and

More information

Logistics. Final Exam on Friday at 3pm in CHEM 102

Logistics. Final Exam on Friday at 3pm in CHEM 102 Java Review Logistics Final Exam on Friday at 3pm in CHEM 102 What is a class? A class is primarily a description of objects, or instances, of that class A class contains one or more constructors to create

More information

Outline. Why Java? (1/2) Why Java? (2/2) Java Compiler and Virtual Machine. Classes. COMP9024: Data Structures and Algorithms

Outline. Why Java? (1/2) Why Java? (2/2) Java Compiler and Virtual Machine. Classes. COMP9024: Data Structures and Algorithms COMP9024: Data Structures and Algorithms Week One: Java Programming Language (I) Hui Wu Session 2, 2016 http://www.cse.unsw.edu.au/~cs9024 Outline Classes and objects Methods Primitive data types and operators

More information

Brief Summary of Java

Brief Summary of Java Brief Summary of Java Java programs are compiled into an intermediate format, known as bytecode, and then run through an interpreter that executes in a Java Virtual Machine (JVM). The basic syntax of Java

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

Two Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types.

Two Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types. Class #07: Java Primitives Software Design I (CS 120): M. Allen, 13 Sep. 2018 Two Types of Types So far, we have mainly been dealing with objects, like DrawingGizmo, Window, Triangle, that are: 1. Specified

More information

Java Overview An introduction to the Java Programming Language

Java Overview An introduction to the Java Programming Language Java Overview An introduction to the Java Programming Language Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhan Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/

More information

Course Status Polymorphism Containers Exceptions Midterm Review. CS Java. Introduction to Java. Andy Mroczkowski

Course Status Polymorphism Containers Exceptions Midterm Review. CS Java. Introduction to Java. Andy Mroczkowski CS 190 - Java Introduction to Java Andy Mroczkowski uamroczk@cs.drexel.edu Department of Computer Science Drexel University February 11, 2008 / Lecture 4 Outline Course Status Course Information & Schedule

More information

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance Contents Topic 04 - Inheritance I. Classes, Superclasses, and Subclasses - Inheritance Hierarchies Controlling Access to Members (public, no modifier, private, protected) Calling constructors of superclass

More information

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today: Java basics: Compilation vs Interpretation Program structure Statements Values Variables Types Operators and Expressions

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 24 October 29, 2018 Arrays, Java ASM Chapter 21 and 22 Announcements HW6: Java Programming (Pennstagram) Due TOMORROW at 11:59pm Reminder: please complete

More information

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can

More information

News and information! Review: Java Programs! Feedback after Lecture 2! Dead-lines for the first two lab assignment have been posted.!

News and information! Review: Java Programs! Feedback after Lecture 2! Dead-lines for the first two lab assignment have been posted.! True object-oriented programming: Dynamic Objects Reference Variables D0010E Object-Oriented Programming and Design Lecture 3 Static Object-Oriented Programming UML" knows-about Eckel: 30-31, 41-46, 107-111,

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING FUNDAMENTALS PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write

More information

Review: Object Diagrams for Inheritance. Type Conformance. Inheritance Structures. Car. Vehicle. Truck. Vehicle. conforms to Object

Review: Object Diagrams for Inheritance. Type Conformance. Inheritance Structures. Car. Vehicle. Truck. Vehicle. conforms to Object Review: Diagrams for Inheritance - String makemodel - int mileage + (String, int) Class #3: Inheritance & Polymorphism Software Design II (CS 220): M. Allen, 25 Jan. 18 + (String, int) + void

More information