Search Suggest

Core Java - Interview Questions and Answers

111.How do you assign values to variables?

Ans: Values are assigned to variables using the assignment operator =.

112. What is a literal? How many types of literals are there?

Ans: A literal represents a value of a certain type where the type describes how that value behaves.
There are different types of literals namely number literals, character literals,
boolean literals, string literals,etc.

113. How do you declare an array?

Ans: Array variable indicates the type of object that the array holds.
Ex: int arr[];

114. Java supports multidimensional arrays.

a)True
b)False
Ans: a.

115. An array of arrays can be created.

a)True
b)False
Ans: a.

116. What is a string?

Ans: A combination of characters is called as string.

117. Strings are instances of the class String.

a)True
b)False
Ans: a.

118. When a string literal is used in the program, Java automatically creates instances of the string class.

a)True
b)False
Ans: a.

119. Which operator is to create and concatenate string?

Ans: Addition operator(+).

120. Which of the following declare an array of string objects?

String[ ] s;
String [ ]s:
String[ s]:
String s[ ]:
Ans : a, b and d


Đăng nhận xét