1

I was trying to use unicode to insert quotes around the "world" in a java hello world program. I forgot to save it and it just worked anyway. I'm just super confused about this.

I use a MacBook Pro with macOS Ventura 13.2.1, and openJDK 19.0.1.

This is the code that I ran.

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, \u0022 + "world!");
    }
}
Cinimod
  • 19
  • 1
  • 2
    `\u022` == `"`. What you have is equivalent to `"Hello, " + "world!"` (i.e., concatenating two strings). – Slaw Apr 28 '23 at 18:55

0 Answers0