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 5 of 7.
Sundar said:
1 decade ago
@Shaswati
It is nothing but a class created by a user.
Ex: Dog, Student, Car etc.
The question is 'what will be default value?'.
Student objStud1;
Here objStud1 will contain 'null' value by default.
It is nothing but a class created by a user.
Ex: Dog, Student, Car etc.
The question is 'what will be default value?'.
Student objStud1;
Here objStud1 will contain 'null' value by default.
Prathyusha said:
1 decade ago
HI,
No where the "Dog" datatype is mentioned.
If Dog is integer , the default might be -0
If Dog is float , the default might be -0.0f
If Dog is object ,the default might be -null
.... No where it is mentioned whether Dog is wat datatype.
HELP ME IN THIS REGARD.....
No where the "Dog" datatype is mentioned.
If Dog is integer , the default might be -0
If Dog is float , the default might be -0.0f
If Dog is object ,the default might be -null
.... No where it is mentioned whether Dog is wat datatype.
HELP ME IN THIS REGARD.....
Suganthan.M said:
1 decade ago
Dog - There is no primitive datatype like 'Dog'. It is a User Defined type. By default it will hold null value.
Suresh said:
1 decade ago
Nice answers
Kathirozhi said:
1 decade ago
Plese correctly tell the char default value is nothing or not null or the answer in the question please help to understand.
Rehana said:
1 decade ago
What is that \u declared in char?
Sivachandran said:
1 decade ago
@Kathirozhi not null and nothing nice answers.
Amarjeetkaur said:
1 decade ago
Please tell me anyone, what is the history of java ? In briefly words.
Gaurav said:
1 decade ago
The most important feature of Java language is that it is Architecture Neutral. Earlier softwares were build for specific operating systems, Like softwares build for Windows They run only in windows not in other os like linux, unix, max etc. To resolve this A new language was introduced by Sunmicrosystems Known as Java and so many features were introduced in this language which makes it a powerful language.
Dagg said:
1 decade ago
Can someone describe: System.out.println();?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers