exam questions

Exam 1z0-808 All Questions

View all questions & answers for the 1z0-808 exam

Exam 1z0-808 topic 1 question 166 discussion

Actual exam question from Oracle's 1z0-808
Question #: 166
Topic #: 1
[All 1z0-808 Questions]

Given:

What is the result?
A.

B.

C.

D.

Show Suggested Answer Hide Answer
Suggested Answer: D

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
DriftKing
4 months, 1 week ago
D. c = null b = false f = 0.0 Code - public class FieldInit { Character c; boolean b; float f; void printAll() { System.out.println("c = "+c); System.out.println("b = "+b); System.out.println("f = "+f); } public static void main(String[] args) { FieldInit f = new FieldInit(); f.printAll(); } }
upvoted 1 times
DriftKing
4 months, 1 week ago
Here "Character" belongs to wrapper class and is not a primitive data type "char". Default value for all wrapper class is always null.
upvoted 2 times
...
...
iSnover
1 year, 3 months ago
The answer is the letter D, if you don't give a variable a value, it will have the default value. Character -> Default value is null Boolean -> Default value is false Float -> Default value is 0.0 OBS: Do not memorize the results of the questions, because there are similar questions, this one for example has a variation that changes "Character" for "char", a variable type "char" does not print anything instead of null. Try to understand how the code works, so you'll get it right when a similar question falls on the test.
upvoted 2 times
alex_au
1 year, 3 months ago
Basically, for all reference types (String, Object, Integer, Character, ...) are all default null while all primitive types are equivalently equals to 0 (char --> \u0000, boolean --> false, int --> 0, float --> 0.0).
upvoted 2 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago