CS 239 – Review for Exam 1

Here is a lits of topics covered in class this semester which you are expected to know and on which you may be tested. Those in black were covered by both Adams and Harris:  those in red only by Adams; those in blue  only by Harris.  You should therefore not expect to be tested on the red and blue items.

 

You should be able to trace code in which any of the following occur.

 

String class methods

Know how to use these and what they produce when they are used

.charAt()

.toCharArray()

.length()

 

Other classes used

          Integer.parseInteger()

          Double.parseDouble()

 

know the default type of a numeric value (i.e. numeric literal)

 

know the meaning of the following modifiers and when it is appropriate to use each

          static

          final

          public

          private

 

Loops – repetition control structures

          for

          foreach

          do

          while

 

selection control structures

          if

          if ... else

          switch

 

use of boolean variables to control loops

 

using command line arguments – review program Calculator.java

Be sure you can write code to read from and write to files using the input and output classes we have discussed

input classes with their methods

Scanner

          .nextInt()

          .next()

          .nextLine()

          .hasNext()

          new Scanner(System.in)

          new Scanner (new File (<filename>))

 

BufferedReader - in Lab1

InputStreamReader - in Lab1

Stdin.readLine( )  - in Lab1

 

output classes with their methods

System.out.print ()

System.out.println ()

BufferedWriter

PrintWriter.print()

PrintWriter.println()

PrintWrite.close()

FileWriter

 

binary representation of decimal integers

 

array

          declarations

          initializers

          item by item initialization

          iterators

          processing

          .length

 

pre-defined constants

          .MAX_VALUE

          .MIN_VALUE

          .SIZE

You should have encountered each of the following Exceptions

You should know at least one instance in which each of them might arise in a program.

          FileNotFound

          StringIndexOutOfBoundsException

          ArrayIndexOutOfBoundsException

          NumberFormatException

          ArithmeticException

InputMismatchException

 

You should also know what happens when an exception is not caught

and how to create an exception.  Review the code in the text on:

Propagating Exceptions

Creating Exceptions

 

try/catch blocks/finally

          try/catch within FOR vs  FOR within try/catch

 

javadocs

          @author

          @param

          @return

          /**  problem description

          */

          @throws

          @exception

 

Given a page from the java API, you should be able to read and understand it and write code using it.

 

user defined types

          enum

          weakness is that values of this type can not be read YET!

 

immutability of

          String objects

          array objects

 

short circuit evaluation

 

use of deMorgan’s laws in negating a compound condition

 

UML diagrams

 

Objects

          constructors

          accessors

          mutators

          instance variables

·        are variables that are associated with an instance of a class different instances of the class may have different values for these variables

    class variables

·        are static variables which means that they are shared by all instances of the class.  A change made to one of them by one instance of the class changes the value that all  instances see.

methods

signature

·        consists of method name and formal parameter list

header

·        consists of method name and formal parameter list plus a return type and modifiers (if any)