|
home—info—lects—labs—exams—hws
textbook—tutor/PIs—java.lang docs—java.util docs
We saw in lecture that to use a variable, we
Another example: here is how we declare a variable named bestSchool which stores the String value "Radford U.":
String bestSchool; bestSchool = "Radford U."; |
bestSchool.charAt(2) |
Practice task: In BlueJ's code pad:
- Declare a variable named bestDorm whose type is String,
- Initialize that variable to stand for "Muse Hall".
If we ask bestDorm what character it has at index 3, what answer will it give? Once you have figured out the answer you expecte, actually
Together, with the lab instructor: In the code pad, we'll ask Strings a different method. try calling a method named “replace”. whose answer is like the original string, except with one set of letters replaced with another.
P2.9 from the textbook (substituting letters in a String).
home—info—lects—labs—exams—hws
textbook—tutor/PIs—java.lang docs—java.util docs
©2009, Ian Barland, Radford University Last modified 2009.Feb.04 (Wed) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |