190 likes | 193 Views
Prepare for Lecture 23 with a review of control structures, classes, scope of variables, static methods, operators, arrays, efficiency, Matlab, recursion, advanced topics, and more in Java. Don't miss this opportunity to strengthen your understanding!
E N D
Announcements • Check your grades on the door of 5141 Upson • More review tomorrow • Review session Sunday night w/Alan • FINAL EXAM: Tuesday August 10, 8 AM (IN THE MORNING) Olin 155 • Review sheet has been handed out -- you should know all the material on this sheet, but do not assume it includes everything you need to know • Bring me pictures and a short note if you want a letter of reference. . . Lecture 23
Review. . . • Know the prelim! • Know the material on the quizzes! • Go over your assignments and make sure you understand where you made mistakes and how you’d fix them. Lecture 23
Control structures • if • if/else • while • for Lecture 23
Classes and subclasses • What’s a class? • What’s an object? • What’s a class hierarchy? • What’s inheritance? How does it work? • What are constructors? What’s super? Lecture 23
More on classes • public vs. private fields and methods • What does it mean to override a method? • Give an example • What does it mean to overload a method? • Give an example Lecture 23
Scope of variables? public class Coordinate { public int x; public int y; public Coordinate(int xx, int yy) { x = xx; y = yy; } public void swapFields() { int tmp; tmp = x; x = y; y = tmp; } • What’s scope? • What’s the scope of a parameter? • A local variable? • A field of a class? Lecture 23
Static • Static variables in a class • Static methods -- give an example? • Why use static variables and methods? Lecture 23
Methods • What are the infamous FOUR STEPS? • What’s a frame? How/when is a frame created? • Know how to draw and label a frame correctly • Call-by-value • Parameter passing (primitive types vs. object references) • return Lecture 23
Operators and statements • The ternary operator in Java • ++, --, -=, += • break; • continue Lecture 23
Arrays • How to declare an array? • How to initialize an array? • Arrays as parameters in C? • Arrays of objects Lecture 23
Search algorithms • Binary vs. linear search • Write linear search • Sketch binary search Lecture 23
Sorting algorithms • Describe each, including bubble sort • Be able to read and debug search algorithms • Understand the partition algorithm Lecture 23
Efficiency • How is the efficiency of an algorithm measured? • What’s linear -- O(n)? • What’s logarithmic -- O(log n)? • What’s the n refer to here? Lecture 23
Matlab • What’s the fundamental data structure in Matlab? • Linspace? What’s that? • Know the colon/semicolon notation • How do you access the row of a matrix? • How do you access the column of a matrix? Lecture 23
More Matlab • What’s the transpose of a matrix? • What does f(x) do in Matlab if x is an array? • What do the control structures look like in Matlab? • Be able to read Matlab code and generate some yourself. Lecture 23
Recursion • What’s recursion? • Give examples of recursive algorithms • Be able to write a small recursive algorithm (something like factorial, for example) Lecture 23
Advanced Topics • What are threads? • What’s the abstract modifier all about? • What are interfaces? When would you use one? • What are exceptions? Lecture 23
C • What are the advantages and disadvantages of C vs. Java? • What are pointers? • Be able to read C code (small examples as presented in class) and understand it Lecture 23
Final thoughts • In 1995, One of the inventors of Java, Bill Joy, said: “Java is just a small, simple, safe, object-oriented, interpreted or dynamically optimized, byte-coded, architecture-neutral, garbage-collected, multithreaded programming language with a strongly typed exception-handling mechanism for writing distributed, dynamically extensible programs.” • Remember: You never finish a program, you just stop working on it. . . • Fun book: Snow Crash by Neal Stephenson Lecture 23