String A= “45”, B= “90”;
String D= A+B+ “200”;
int x= Integer.parseInt(A);
int y= Integer.parseInt(B);
int d= x+y;
System.out.println(“Result 1=” +D);
System.out.println(“Result 1=” +d);
Answers
Answered by
3
Answer:
x+y
= 200+ 90
= 290.
is the correct answer .
Thank you .
Good night
Have a sweet dreams
Answered by
2
- A="45"
- B="90"
- D=A+B+"200";
Here A and B are string variable even if they are storing numbers so instead of getting added, it will get concatenated.
D="45"+"90"+"200"
= "4590200"
//Strings get concatenated, numbers (in data types : short, int, float, long, double) are added
int x= Integer.parseInt(A);
int y= Integer.parseInt(B);
- Integer.parseInt() converts string to integer
- so x and y storing integer number of A and B
- so x and y id 45 and 90 respectively but in integer data type.
d=x+y
= 45+90
= 135
- Remember:- Java is case-sensitive language so d and D are different.
Output:-
Result 1=4590200
Result 1=135
Similar questions
Social Sciences,
25 days ago
English,
25 days ago
Computer Science,
1 month ago
Science,
1 month ago
Math,
9 months ago
Math,
9 months ago
Computer Science,
9 months ago