Question: Consider the following code: 1 int numberoffriends = 7 ; if ( numberoffriends > 5 ) { int numberofcars = 2 ; else { int

Consider the following code:
1 int numberoffriends =7;
if (numberoffriends >5){
int numberofcars =2;
else {
int numberofcars =1;
}
9 system.out.println("We will need to take "+ numberofCars +" cars.");
The code has an error. What is it?
On line 9, the variable numberOfCars has a scoping issue and does not exist
There is a semi-colon issue
It is possible that numberofCars has not been declared
There is a bracket issue
 Consider the following code: 1 int numberoffriends =7; if (numberoffriends >5){

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 Databases Questions!