Java Programming - Language Fundamentals - Discussion
Discussion Forum : Language Fundamentals - General Questions (Q.No. 1)
1.
Which four options describe the correct default values for array elements of the types indicated?
- int -> 0
- String -> "null"
- Dog -> null
- char -> '\u0000'
- float -> 0.0f
- boolean -> true
Answer: Option
Explanation:
(1), (3), (4), (5) are the correct statements.
(2) is wrong because the default value for a String (and any other object reference) is null, with no quotes.
(6) is wrong because the default value for boolean elements is false.
Discussion:
64 comments Page 4 of 7.
Jayesh said:
9 years ago
Is dog is which type of data type is it enumerated data type are users defined the data type?
(3)
Asad said:
1 decade ago
Integer 0.
Float 0. 0.
Double 0. 0.
String null.
Character has nothing as default value.
Float 0. 0.
Double 0. 0.
String null.
Character has nothing as default value.
Ravi said:
6 months ago
@All.
Here, String="null" is not correct because null is written in double parenthesis.
Here, String="null" is not correct because null is written in double parenthesis.
(3)
Subhash said:
10 years ago
All other datatypes are predefined except Dog, which is meaningless in this question.
Indu said:
9 years ago
Please explain the difference between the method overloading and method overriding?
(1)
Sunil said:
1 decade ago
Int-0.
Float-0.0.
Char-space.
Boolean-false.
Byte-0.
Short-0.
Long-0.
Double-0.0.
Float-0.0.
Char-space.
Boolean-false.
Byte-0.
Short-0.
Long-0.
Double-0.0.
Manasa said:
1 decade ago
How can a char has a default value in terms of hexa-decimal?
Can any one clear?
Can any one clear?
Garima S said:
1 decade ago
Not able to undestand the given question.
Can anyone please explain it to me?
Can anyone please explain it to me?
Amarjeetkaur said:
1 decade ago
Please tell me anyone, what is the history of java ? In briefly words.
Nani said:
5 years ago
Here, Dog is not a primitive data type. It is a user defined data type.
(24)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers