[Link to
this document as a Word .doc file ]
15-100 Final Exam Information
Spring 2008
The final examination for all sections of 15-100 will be given on Monday, May 5 from 5:30-8:30PM. Your instructor will tell you what room to report to for your exam.
Topics
The final exam this semester will be a written exam based on the following topics from 15-100:
Students are not allowed to use any additional material (books, notes, etc.) during the exam. Students will be supplied with an API for the String class on the exam. (See next page.)
On the day of the final exam
public final class String
sample String API
extends Object
implements Comparable
The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class.
Constructor Summary
Initializes a newly created String object so that it
represents the same sequence of characters
as the argument; in other words, the newly created string is a copy of the
argument string.
Method Summary
char charAt(int index)
Returns the character at the specified index.
int compareTo(String anotherString)
Returns a negative integer, zero, or a positive
integer if this string is lexicographically less
than, equal to, or greater than the string specified in the argument,
respectively.
boolean equals(String anotherString)
Returns true if this string has the exact same
sequence of characters as the specified string.
Otherwise, returns false.
int indexOf(char c)
Returns the index of the first occurrence of the
specified character in this string. Returns -1 if
there is no such occurrence.
int length()
Returns the length of this string.
String replace(char oldChar, char newChar)
Returns a new string resulting from replacing all
occurrences of oldChar in this string with
newChar.
String substring(int beginIndex)
Returns a new substring of this string from beginIndex to the end of this string.
String substring(int beginIndex, int endIndex)
Returns a new substring of this string from beginIndex up to but not including endIndex.
Returns a new string that is a copy of this String converted to lower case.
Returns a new string that is a copy of this String converted to upper case.