Question
Juestion 3 (10 points) Please write the result of the codes, If there is an error, then please explain what the error is. Codes int
Juestion 3 (10 points)
Please write the result of the codes, If there is an error, then please explain what the error is.
Codes
int cans
6;
cans
cans cans
cans
System.out.printin(cans);
&
int result = 7/4;
System.out.printin(result);
&
int result = 7%4;
System.out.printin(result);
&
String name = "Sally";
System.out.printin(name.substring(1,4));
&
String name ="MIS103", name2="-" System.out.print(name.substring(0,3)); System.out.print(name2);
System.out.print(name.substring(3));
double price = 10/3;
System.out.printf("%.2f", price);
&
if("Tomato".substring(0,3) == ("Tom")}{System.out.print("BUS103");}
&
if("Tomato".substring(0,3).equals("Tom")}{System.out.print("Fall2022");}
&
int i=0, sum=10;
while (sum < 10) {
i++;
sum = sum - i;
&
System.out.print("i");}
int n=5;
while (n>0){
n--; System.out.print(n);}
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