121. What is the value of a[3] as the result of the following array declaration?
1
2
3
4
Ans : d
122. Which of the following are primitive types?
byte
String
integer
Float
Ans : a.
123. What is the range of the char type?
Ans: Array variable indicates the type of object that the array holds.
Ex: int arr[];
124. What are primitive data types?
Ans : byte, short, int, long
float, double
boolean
char
125. What are default values of different primitive types?
Ans : int - 0
short - 0
byte - 0
long - 0 l
float - 0.0 f
double - 0.0 d
boolean - false
char - null
126. Converting of primitive types to objects can be explicitly.
a)True
b)False
Ans: b.
127. How do we change the values of the elements of the array?
Ans : The array subscript expression can be used to change the values of the elements of the array.
128. What is static variable?
Ans : Static variables are shared by all instances of a class.
129. What is final varaible?
Any variable either member variable or local variable (declared inside method or block) modified by final keyword is called final variable. Final variables are often declare with static keyword in java and treated as constant. Here is an example of final variable in Java.
130. Which of the following declare an array of string objects?
String[ ] s;
String [ ]s:
String[ s]:
String s[ ]:
Ans : a, b and d
0 Comments