Looking for Програмування мовою Java test answers and solutions? Browse our comprehensive collection of verified answers for Програмування мовою Java at moodle.chnu.edu.ua.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
(Java)
1 class A {
2 int a;
3 A (int x) {
4 a = x;
5 }
6 }
7 class B extends A {
8 int b;
9 B (int x) {
10 super.A (x);
11 b = x;
12}
13}
Виконання програми завершилося помилкою. Яка зміна необхідно внести, щоб виключити помилку?
(Java)
(Java)
(Java)
Відзначте ті з них, які є інтерфейсами.
(Java)
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 Car) {
c [0] = new Vehicle ();
}
}
public void setVehicles3 (Vehicle c []) {
if (c [0] instanceof Vehicle) {
c [0] = new Car ();
}
}
}
class Car extends Vehicle { }
(Java)
int i = 4;
while (i <5) {
try {
if (i> = 2)
System.out.print (12 / i);
else {
System.out.print (6 / i ++);
throw new ArithmeticException ( "newEx");
}
}
catch (ArithmeticException e) {
System.out.print ( "0");
break;
}
i--;
}