This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes doubts regarding OCJP questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "doubts regarding OCJP questions" Watch "doubts regarding OCJP questions" New topic
Author

doubts regarding OCJP questions

Nikhitha Pai
Greenhorn

Joined: Sep 17, 2012
Posts: 19
1) How to convert hexadecimal octal values to their corresponding decimal equivalents.?

Say for example we are given
float f3 = 0x12345;

It is a silly question i guess. But pease do reply
Another Question
How will you calculate what character is represented actually , if given a character literal like ‘\ufeeg’
Example : Which three are valid declarations of a char? (Choose three.)
A. char c1 = 064770;
B. char c2 = ‘face’;
C. char c3 = 0xbeef;
D. char c4 = \u0022;
E. char c5 = ‘\iface’;
F. char c6 = ‘\uface’;

Thanks and Regards
Nikhitha
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

answer to your first question, when you assign hex value to a float variable
then compiler implicitly convert the hex value to decimal and assigned to the float variable.
just print f3 and see.

coming to your second question,
you need to go through char declaration in JLS => here
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

and Please, UseOneThreadPerQuestion
Nikhitha Pai
Greenhorn

Joined: Sep 17, 2012
Posts: 19
Hi,
Thank you for the reply.
Often we find questions where they give octal or hexadecimal values and ask what is the resut of shift operations . In such cases to evaluate the expression, how do you convert the hexadecimal and octal values to decimal equivalents manually, do the shift operations and get the answer . Could you please give an example.

Sorry for posting two questions in the previous thread.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doubts regarding OCJP questions
 
Similar Threads
A question about Dan Mock Exam Chapter 2 Exam 2
why char data of two bytes.
char insertion in strings
Help, How to validate french chars? (Base on external file name)
How to validate french chars? (Base on external file name)