Advertisements
Advertisements
Question
Give the output of the following code.
String A = "26.0", B= "74.0";
double C = Double.parseDouble(A);
double D = Double.parseDouble(B);
System.out.println((C+D));
Options
26
74
100.0
2674
Advertisements
Solution
100.0
Explanation:
double C = Double.parseDouble(A);
gives C as 7 4.0
double D = Double.parseDouble(B);
gives D as 24.0
C + D gives 100.0
APPEARS IN
RELATED QUESTIONS
Write the memory capacity (storage size) of short and float data type in bytes.
Differentiate between if else if and switch-case statements.
State the data type and value of res after the following is executed :
char ch = ‘9’;
res = Character. isDigit(ch)
State the number of bytes occupied by char and int data types.
State the data type and value of res after the following is executed:
char ch = ‘t’;
res=Character. toUpperCase(ch);
int res = ‘A’;
What is the value of res?
Write the return data type of the following function:
log( )
State one difference between the floating point literals float and double.
Give the output of the following Character class method:
Character.toUpperCase('a')Predict the output of the following code snippet:
char ch='B';
char chr=Character.toLowerCase(ch);
int n=(int)chr-10;
System.out.println((char)n+"\t"+chr);
