[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/xinan-w/OnJava8-Examples/master/strings/Immutable.java [Back]  [Original]

// strings/Immutable.java
// (c)2021 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.

public class Immutable {
  public static String upcase(String s) {
    return s.toUpperCase();
  }
  public static void main(String[] args) {
    String q = "howdy";
    System.out.println(q); // howdy
    String qq = upcase(q);
    System.out.println(qq); // HOWDY
    System.out.println(q); // howdy
  }
}
/* Output:
howdy
HOWDY
howdy
*/

Web Proxy Viewer  |  New URL  |  Original Page