State the data type and value of res after the following is executed:
char ch='t';
res= Character.toUpperCase(ch);
Views 18
Answer:
Data type of res is char and its value is T.
-
Data Type of
res
:-
The
Character.toUpperCase(ch)
method returns achar
type. Hence, the data type ofres
will bechar
.
-
-
Value of
res
:-
The
Character.toUpperCase(ch)
method converts the characterch
to its uppercase equivalent. In this case,'t'
is converted to'T'
. -
So, the value of
res
will be'T'
.
-
In summary:
-
Data Type:
char
-
Value:
'T'
Related Articles:
This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.
Join Our telegram group to ask Questions
Click below button to join our groups.