CodeBot
CodeBot

Reputation: 155

what is the file encoding type for java class file?

What is the file encoding type used for Java class files?

I am not referring to the file.encoding or Charset.defaultCharset() properties.

When javac compiles a .java file to a .class file and saves the resulting file on disk, what file encoding type is used? Is it UTF-8?

Can someone provide more details on this? I do not want to make assumptions.

Upvotes: 0

Views: 438

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500515

Encoding refers to text, not binary data.

Class files are binary data - so there's no notion of a text encoding for them, any more than there is for an MP3 file or a JPEG.

Do not try to read a class file as if it's text - you're almost certain to lose information.

Upvotes: 3

Related Questions