Question: 1 . Find the error in the following code do String str 2 = Selenium; String temp = ; int j = str

1. Find the error in the following code do
String str2= "Selenium";
String temp ="" ;
int j = str2.length()-1;
for(int i=j; i>=0; i--);
{temp = temp + str2.charAt(i);
System.out.println(temp);
}
a. No error in code
b. Remove ; in for loop
c. charAt(i) needs to be charAt(j)
d. String temp cannot be "".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!