fork download
  1. class Ideone
  2. {
  3. // s1 is a compile-time constant
  4. private static final String s1 = "aaa";
  5.  
  6. // so is s2
  7. private static final String s2 = "bbb";
  8.  
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. // which means the expression s1+s2 can be folded into another constant
  12. String s3 = s1+s2;
  13.  
  14. System.out.println("aaabbb" == s3);
  15. }
  16. }
Success #stdin #stdout 0.07s 380160KB
stdin
Standard input is empty
stdout
true