The entered number is 10
Just like nextInt, the Scanner class has several other
methods that can be used to read
data of different types like
String, float, long, boolean, etc.
021.
a.
b.
c.
d.
e.
f.
022.
CHAPTER
03
Data Types, Variables and Arrays
What are the possible ways of declaring an array of short
data type?
Answer:
You can declare an array of short data type in any of the following
ways:
short a1[];
short [] a2;
short b1[] [];
short [] [] b2;
short [] c1 = {2,3,4};
short c2[] = {2,3,4};
Approaches
a and
b declare a single dimensional short array.
Approaches
c and
d declare a two–dimensional short array.
Approaches
e and
f declare a single
dimensional short array and
initialize it. In all the approaches,
the square brackets can be
placed either after the variable name or after the short keyword.
Do'stlaringiz bilan baham: