Zach B.
Zach B.

Reputation: 693

Can Java comments be seen by decompiling?

I was wondering if I put comments in my code and when someone tried to decompile it, if they could read the comments that I put?

Upvotes: 4

Views: 5596

Answers (4)

Behrang Saeedzadeh
Behrang Saeedzadeh

Reputation: 47913

No. And you can verify this by using DJ Java Decompiler, for example. If you also refer to the Java Class File Format, you'll see there's no construct for storing comments.

Upvotes: 2

Ken Wayne VanderLinde
Ken Wayne VanderLinde

Reputation: 19339

Comments aren't included in the .class files, so a decompiler won't be able to produce them.

Upvotes: 1

Jonathon Reinhart
Jonathon Reinhart

Reputation: 137398

No, comments are never included as part of the compilation process. They are typically removed in some sort of pre-processing, or first-pass stage.

Upvotes: 9

Paul Bellora
Paul Bellora

Reputation: 55213

Nope, comments are discarded by the compiler.

Upvotes: 5

Related Questions