Presentation is loading. Please wait.

Presentation is loading. Please wait.

FINAL EXAM Final Exam Tuesday, May 3: 1:00 - 3:00 PM (Phys 112)

Similar presentations


Presentation on theme: "FINAL EXAM Final Exam Tuesday, May 3: 1:00 - 3:00 PM (Phys 112)"— Presentation transcript:

1 FINAL EXAM Final Exam Tuesday, May 3: 1:00 - 3:00 PM (Phys 112)
Cumulative (weighted towards recent material) 40 MC (2 points each), 6 programming (20 points each) = 200 points total Old Final Exams Available On Website

2 Chapter 1: Introduction to Computers and Java
Hardware, memory Object Oriented Programming: Encapsulation, Polymorphism, Inheritance Java Programs: .java, .class files, byte-code interpreter

3 Chapter 2: Primitive Types, Strings, and Console I/O
Variables (int, char, float, etc): declarations and assignment Type Casting: Implicit and Explicit Integer/Float Division, Parentheses/Precedence Rules String class: concatenation, indices (0 to n-1) String methods: length(), equals(), trim(), charAt(), compareTo() SavitchIn: readInt(), readLineFloat(), readLine(), etc

4 Chapter 3: Flow of Control
If-else statements, nested if-else statements Comparison operators (==, !=, >, <=, etc) Boolean operators: &&, || Switch statement (make sure to have “break;”) While loop: 0 or more iterations Do-while loop: 1 or more iterations For loops: for(initialize; boolean_check; update_action) Nested loops Boolean type (only “true” or “false” values)

5 Chapter 4: Defining Classes and Methods
Class definition: “public class Class_name {“ Public/private data variables Method definition: “public type method_name {“ Methods return values (int, string, etc) or don’t (null) Invoking methods: “object_name.method_name();” Creating objects: “Class_name variable_name = new class_name();” The “this” parameter Information hiding/encapsulation Objects variables: references (memory address) vs. data Equals methods for classes

6 Chapter 5: More About Objects and Methods
Static methods: called without an object (e.g. SavitchIn) Wrapper classes: Integer, Double Method overloading: different parameters (cannot change return type) Constructors: default and others

7 Chapter 6: Arrays Creating/accessing arrays
Arrays are a reference to memory segment For loop: stepping through arrays (.length) (watch out for: ArrayIndexOutOfBounds exceptions) Arrays of objects Sorting arrays: selection sort Multi-dimensional arrays

8 Chapter 7: Inheritance Declaration: “public class Class_name extends Class_name2” Overriding method definitions (“final” modifier: method can’t be overridden) Superclass constructor calls: “super(parameters)” Interface implementation: “public class Class_name implements Interface_name” Implement/Extend: can implement multiple interfaces (comma separated) but extend only one class

9 Chapter 8: Exception Handling
Try/catch/finally block Throwing exceptions: “throw new Exception(“info”);” getMessage for exceptions Defining your own exception classes: “public class Class_name extends Exception” Methods throwing exceptions: “public void method_name() throws DivideByZeroException” – don’t have to handle exception in this method but must in calling method Multiple exception handling (hierarchy)

10 Chapter 9: Streams and File I/O
Need: import java.io.*; StringTokenizer class Be sure to try/catch IOExceptions Text Files: - PrintWriter outputStream = new PrintWriter(new FileOutputStream(“filename”); - BufferedReader inputStream = new BufferedReader(new FileReader(“filename”); - reads nothing at end of file (null) Binary Files: - ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(“filename”); - ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(“filename”); - throws EOFException at end of file

11 Chapter 10: Dynamic Data Structures
Need: import java.util.*; Vectors: declaring, adding elements, setting elements, retrieving elements Be sure to use wrapper classes, not primitive types Linked Lists: creating classes (link to object of same type) Empty List: null pointer (last item always points to null)

12 Chapter 11: Recursion Three things needed: 1. Branching statement
2. Recursive call 3. Stopping case (aka “Base case”) Can always write recursive methods as iterative but not always easier to write/understand Binary Search Merge Sort

13 Chapter 12: Window Interfaces Using Swing
Event-driven programming (button clicks, etc) Need: import javax.swing.*; import java.awt.*; import java.awt.event.*; Declaring swing class: “public class Class_name extends JFrame” JLabel, JButton, JTextArea, JTextField, Jpanel, ContentPane Constructor: set size etc, be sure to “setVisible(true);” Layout Managers: FlowLayout, BorderLayout, GridLayout ActionListener method for handling events: “… implements ActionListener”

14 Chapter 13: Applets and HTML
Same imports needed as swing Classes: “public class Class_name extends JApplet” Need: “public void init()” method: no constructor, no setVisible

15 Chapter 14: More Swing Menus: JMenu, JMenuItem, JMenuBar Nesting menus
Icons, JScrollPane Layout Managers: BoxLayout, CardLayout Inner classes


Download ppt "FINAL EXAM Final Exam Tuesday, May 3: 1:00 - 3:00 PM (Phys 112)"

Similar presentations


Ads by Google