java.lang.Object | +--SlideE2
SlideE2 contains more little bits and pieces of example code for lecture E, Variables. The focus is on understanding how casting works, and various other details of using data values and variables in Java.
Field Summary | |
(package private) double |
addend
a double value for adding |
(package private) int |
baseA
an integer base value |
(package private) double |
baseB
a double base value |
(package private) double |
factor
a double value for multiplying |
(package private) int |
sumA
the current int sum |
(package private) double |
sumB
the current double sum |
Constructor Summary | |
SlideE2()
Initialize the various bits that we need in the example methods. |
Method Summary | |
void |
caster()
This method updates the two sum values, using a variety of casts to convert values from one type to another. |
double |
getCumulativeValue()
Get the cumulative value of whatever it is we are keeping track of. |
int |
getSumA()
Get the current integer sum. |
double |
getSumB()
Get the current double sum. |
static void |
main(java.lang.String[] args)
A test harness for the code in this class. |
void |
notLikeThis(java.lang.String aName)
This method has some problems. |
void |
reset()
Do the actual reset of the variable values to their default values. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
double addend
int baseA
double baseB
double factor
int sumA
double sumB
Constructor Detail |
public SlideE2()
Method Detail |
public void caster()
public double getCumulativeValue()
public int getSumA()
public double getSumB()
public static void main(java.lang.String[] args)
args
- ignoredpublic void notLikeThis(java.lang.String aName)
The list of Java keywords is provided in the Java Language Specification, section 3.9, Keywords. The online URL is java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#229308.
aName
- a String parameter variable that has a name collision with a local variablepublic void reset()