2015-04-20 15:36:01 -07:00
|
|
|
|
//: strings/Immutable.java
|
2015-05-29 14:18:51 -07:00
|
|
|
|
// <20>2015 MindView LLC: see Copyright.txt
|
2015-04-20 15:36:01 -07:00
|
|
|
|
import static net.mindview.util.Print.*;
|
|
|
|
|
|
|
|
|
|
public class Immutable {
|
|
|
|
|
public static String upcase(String s) {
|
|
|
|
|
return s.toUpperCase();
|
|
|
|
|
}
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
String q = "howdy";
|
|
|
|
|
print(q); // howdy
|
|
|
|
|
String qq = upcase(q);
|
|
|
|
|
print(qq); // HOWDY
|
|
|
|
|
print(q); // howdy
|
|
|
|
|
}
|
|
|
|
|
} /* Output:
|
|
|
|
|
howdy
|
|
|
|
|
HOWDY
|
|
|
|
|
howdy
|
|
|
|
|
*///:~
|