Question
For each of the following statements, give the value of the variable after the statement or indicate the error in the statement. Dont assume any
For each of the following statements, give the value of the variable after the statement or indicate the error in the statement. Dont assume any other variables have been declared. Update note: for (j), (m), and (s) give the default value for that type. Parts (o) and (r) have been modied to lowercase.
(a) int i = 1+2+3+4;
(b) int i = 2%3;
(c) 2%3 = int i;
(d) int i = 3 / 4.0;
(e) int i = 3+9/4;
(f) int i == 3*7 - 10/3;
(g) String s = "abc" + 2 + 3;
(h) String s = 2 + 3 + "abc" ;
(I) String s = abc + 2;
(j) String s;
(k) double x = 3/4;
(l) double x = 3 + 9.0/4.0 ;
(m) double x;
(n) boolean b = True && False;
(o) boolean b = true || false;
(p) boolean b = 5<3 || 3> 0;
(q) boolean b = (5> 2) && (5 < 10)
(r) boolean b = !!false;
(s) boolean b;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started