Final Review - PowerPoint PPT Presentation

About This Presentation
Title:

Final Review

Description:

Data conversion -casting. Graphics ... Calling methods with this parent object calls the child method of the same name if it exists ... – PowerPoint PPT presentation

Number of Views:12
Avg rating:3.0/5.0
Slides: 17
Provided by: sean93
Learn more at: https://cs.gmu.edu
Category:

less

Transcript and Presenter's Notes

Title: Final Review


1
Final Review
  • Lecture 14

2
Basics Chapter 1
  • Computer Basics
  • Binary-1s and 0s
  • Bits and Bytes
  • Characters Encryption into binary, ASCII and
    Unicode(Java)
  • Networks
  • Java language, compilation, interpretation, Java
    Virtual Machine

3
Chapter 2
  • String class
  • String variables
  • Printing to the monitor, System.out.println
  • Concationation of strings
  • Primitive Variable Types
  • ints, doubles, chars, booleans
  • Arithmetic operators , - /, --, -,,,/
  • Chars-uppercase and lower case, subtract 32 from
    a, get A
  • Wrapper classes Integer, Double, methods, calling
    methods of class
  • Data conversion -casting
  • Graphics
  • Drawing on screen, coordinate system, drawing
    methods (drawRect) etc.

4
Chapter 3
  • String class again.
  • String methods -calling them
  • Using classes
  • Random
  • Math
  • Graphics
  • Graphics
  • Components and containers-frame and panel
  • Graphics class (paintComponent( Graphics g))

5
Chapter 4
  • Classes Using and Writing
  • Using classes-
  • Jbutton button new Jbutton(press me)
    declaring and instantiating objects of a class.
    constructors
  • button.addActionListener(this) calling class
    methods
  • Class is a template, has variables and methods
    defined.
  • Writing classes
  • Constructors- default constructors- other
    constructors
  • Variables-instance-private
  • Methods - non-static, public
  • Methods-non static in classes
  • Void and those that return a value
  • Parameters
  • Accessing with an object of the class
  • Accessing methods of static classes

6
Chapter 4 continued
  • Static
  • Static variables
  • Static methods-cant call non static
  • Variables
  • Global
  • Instance
  • Local
  • Graphics
  • Components interactive (buttons etc)
  • Events
  • Interfaces required to activate
    components-requires methods of interface to be
    defined in class that implements interface

7
Chapter 5
  • Control Structures
  • boolean operators lt, lt, gt, gt, !, !
  • boolean expressions
  • structures
  • if
  • if..else
  • switch
  • while
  • dowhile
  • for
  • compound statements, blocks

8
Chapter 5 continued
  • Graphics
  • Custom panels and listeners
  • Radio buttons,
  • Dialog Boxes
  • Determining event sources with if statements

9
Chapter 6
  • Writing classes, how to
  • Overloading methods
  • Interfaces
  • Abstract methods
  • Implementing interfaces
  • Graphics
  • Layouts

10
Chapter 7
  • Arrays single and double dimensioned
  • Declaring and creating arrays of primitives
  • Declaring and creating arrays of objects
  • Accessing an array element
  • For loops to access all array elements and
    manipulate them
  • Command Line Arguments
  • Using arrays as parameters of methods
  • Graphics
  • Listener interfaces for mouse,

11
Chapter 8
  • Inheritance-classes
  • Child classes - extends
  • Overriding of methods in child classes
  • Definition, use
  • this
  • super
  • Graphics
  • Timer class
  • paintComponent method

12
Chapter 9
  • Polymorphism- means many forms
  • Polymorphism in Java classes - late binding
  • Classes-
  • Assigning an object of a child class to a parent
    object
  • Calling methods with this parent object calls the
    child method of the same name if it exists
  • Book b new ComicBook() //assigning a child to
    a parent object
  • b.method1() //call to method1 will call
    ComicBook method1 if it exists.
  • Interfaces Polymorphism
  • Can declare variables with type equal to some
    interface
  • Can then assign an object of any class that
    implements that interface to the interface
    object
  • Suppose you have an interface Interface and a
    class implementing that interface ClassB.
  • You can declare a variable Interface I
  • You can assign to I an object of type ClassB I
    new ClassB()

13
Chapter 9 continued
  • Sorting
  • Sorting 5 8 1 3
  • Selection Sort- Order n squared
  • Given list above, go through list and find
    smallest
  • Swap that with whatever is first in the list now.
    1 8 5 3
  • Go through the remainder of the list and get the
    lowest 3
  • Swap that with the second element of the list 1 3
    5 8
  • Continue until finished
  • Insertion Sort Order n squared
  • Put first element into sorted list in proper
    place 5 813
  • Put next element into sorted list in proper place
    5 8 1 3
  • Continue until all elements are in sorted list

14
Chapter 9 continued
  • Searching looking for a particular element in a
    list
  • Looking for 8 in this list 1 6 4 10 20 5 8
  • Linear Search Order n
  • Begin at the beginning and look through the list
    for 8.
  • Binary Search Order Ln(natural log) n
  • Must first sort the list 1 4 5 6 8 10 20
  • Then go to the middle of the list say 6
  • Check if 6 is larger or smaller than your target
    8
  • As it is smaller, drop the first half of the list
  • Go to the middle of what is left say 10
  • Ask again whether this is bigger or smaller, its
    bigger
  • Drop the last half of the list and continue until
    you find the element of the list is exhausted.

15
Chapter 10
  • Exception Handling in Java
  • trycatch block
  • throws clause
  • Checked vs unchecked exceptions
  • I/O from files and input from keyboard- checked
    exceptions
  • Split panes
  • Scroll Panes

16
I/O
  • I/O Classes
  • FileReader,BufferedReader
  • FileWriter,BufferedWriter
  • InputStreamReader, BufferedReader
  • Methods
  • readLine(), write()
  • StringTokenizer class
  • Declaring an new object for each line of input,
    String line in.readLine() default uses blanks
    to separate elements of line
  • StringTokenizer tokenizernew StringTokenizer(line
    )
  • Use hasMoreTokens() in a while loop to process
    all words in each line. While (tokenizer.hasMoreT
    okens())
  • Inside the loop use String word
    line.nextToken()
Write a Comment
User Comments (0)
About PowerShow.com