fork(2) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class InternStringExample {
  6. public static void main (String[] args) throws java.lang.Exception {
  7. String input = reader.readLine().intern();
  8. if(input == "hello") {
  9. System.out.println("input == hello");
  10. } else if(input == "Hello") {
  11. System.out.println("input == Hello");
  12. } else if(input == "test") {
  13. System.out.println("input == test");
  14. } else {
  15. System.out.println("no match found for: " + input);
  16. }
  17. }
  18. }
Success #stdin #stdout 0.09s 27828KB
stdin
Hello
stdout
input == Hello