logo

Crowdly

Browser

Add to Chrome

Який метод згенерує помилку ArrayStoreException при передачі в нього масиву v ? ...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Який метод згенерує помилку ArrayStoreException при передачі в нього масиву v ?

public class Vehicle {

public static void main (String [] args) {

Vehicle [] v = new Car [] {new Car () };

...

}

public void setVehicles (Vehicle c []) {

c [0] = new Vehicle ();

}

public void setVehicles2 (Vehicle c []) {

if (c [0] instanceof Vehicle) {

c [0] = new Car ();

}

}

public void setVehicles3 (Vehicle c []) {

if (c [0] instanceof Car) {

c [0] = new Vehicle ();

}

}

}

class Car extends Vehicle { }

(Java)

More questions like this

Want instant access to all verified answers on moodle.chnu.edu.ua?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome