About Question enthuware.ocajp.i.v8.2.2017 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
Sieusc
Posts: 16
Joined: Mon Mar 02, 2020 3:38 am
Contact:

About Question enthuware.ocajp.i.v8.2.2017 :

Post by Sieusc »

I did not know that a char with default value 0 would not print anything, Thanks for the extensive information. In my opionion this question is at the very least a "tough" one, and most definately not easy or very easy.

admin
Site Admin
Posts: 8913
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.2017 :

Post by admin »

Updated the toughness rating.
Thank you for your feedback!
If you like our products and services, please help us by posting your review here.

VijayTripathi
Posts: 8
Joined: Mon Jul 06, 2020 1:11 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.2017 :

Post by VijayTripathi »

For char, the print/println methods translate the character into one or more bytes according to the platform's default character encoding. That is why while printing a char value of 0, a blank space is printed instead of 0 (even though the char's integral value is 0).

Can you please elaborate this. Unable to understand the mystry.

admin
Site Admin
Posts: 8913
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.2017 :

Post by admin »

Not really sure which part you don't understand. Like the ascii value of 'a' is 97, so, if you try to print a char variable containing 97, a will be printed. Similarly, whatever character is represented by value 0, that is printed (it is just a blank character).
If you like our products and services, please help us by posting your review here.

VijayTripathi
Posts: 8
Joined: Mon Jul 06, 2020 1:11 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.2017 :

Post by VijayTripathi »

admin wrote:
Sat Aug 01, 2020 11:08 am
Not really sure which part you don't understand. Like the ascii value of 'a' is 97, so, if you try to print a char variable containing 97, a will be printed. Similarly, whatever character is represented by value 0, that is printed (it is just a blank character).
So, though 0 don't have any character representation that's why it is printing space. Thanks for the explanation.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests