FINAL EXAM - PowerPoint PPT Presentation

About This Presentation
Title:

FINAL EXAM

Description:

Chapter 12 – PowerPoint PPT presentation

Number of Views:54
Avg rating:3.0/5.0
Slides: 16
Provided by: BrianD185
Category:

less

Transcript and Presenter's Notes

Title: FINAL EXAM


1
FINAL EXAM
  • Final Exam
  • Tuesday, May 3 100 - 300 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 (, !, gt, lt, 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 dont
    (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 cant 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
    dont 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(file
    name)
  • - ObjectInputStream inputStream
  • new ObjectInputStream(new FileInputStream(filena
    me)
  • - 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
Write a Comment
User Comments (0)
About PowerShow.com