Question: Need help with critical thinking java questions: Explain the scope of each of the variables in the code below: public class ScopeExample { public static
Need help with critical thinking java questions:
- Explain the scope of each of the variables in the code below:
public class ScopeExample {
public static void method1() {
int var3;
for (int var4 = 0; var4 < 2; var4++) {
var3 +=1;
}
}
}
End of code
2.Find and explain the error in the code below:
public class MethodCallExample {
public static int doSomething() {
return(5);
}
}
public static void main(String[] args) {
int num;
doSomething();
num = doSomething():
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
