Unicode escape trick

●4 ●16 ●27
calendar_today • schedule1 min read

A simple Unicode escape trick

Do you think the following Java code can compile correctly?

public class HelloWorld {
    public static void main(String[] args) {
// This is the first single line comment \u0009\u000a\u000c\u002f\u002a#######
# This is between two single line comments
# How is this line getting compiled?
# The lines between the two single line comments are being treated like comment, why?
# I don't think # is a comment in java.
// This is the second single line comment  \u0009\u000a\u000c #### \u002a\u002f
        System.out.println("Hello world!");
    }
}

Please comment to explain why this code compiles.

2 Comments

0 votes
0 votes
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

About Identifiers in Java

Pravin - Sep 1, 2025

Unicode escape' codec can't decode bytes in position 2-3: truncated \ uxxxxxxxx escape

Jundarer - May 9

LangGraph4j Annotations: Organize Graph Behavior with Action Catalogs

bsorrentino 1 - Oct 23

Why Does a Backend API Become Slow, and How Can We Fix It?

Cerad - Oct 20

The Order Was Saved. The Kafka Event Might Never Arrive.

Sudhanshu.thakur - Oct 13
chevron_left
2.5k Points • 47 Badges
India
7Posts
36Comments
8Connections
Java Trainer and Evangelist

Related Jobs

Commenters (This Week)

1 comment
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!