- Create a new class named StringsImmutable.
- Create a main method and add the following code.
public class StringsImmutable{ public static void main(String[] args){ String name = "Alan Turing"; System.out.println(name + " :" + name.hashCode()); name = name.toUpperCase(); System.out.println(name + " : " + name.hashCode()); } }
- Compile and run the program.
$ javac StringsImmutable.java $ java StringsImmutable Alan Turing :-528410695 ALAN TURING : -791838791