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!
if (i == 0)
throw new ClassCastException ( "first");
if (i == 2)
throw new ClassNotFoundException ( "second");
(Java)
class A {
int x = 0;
int y = 0;
}
Що буде виведено на екран в результаті виконання наступного фрагмента програми?
A x;
System.out.print (x);
x = new A ();
System.out.println (xx);
1 class A {
2 int a;
3 int b;
4}
5 class B extends A {
6 int b;
7 ...
8 }
Яким кодом необхідно доповнити опис конструктора класу B, що успадковує клас A, щоб при створенні об'кта класу B, змінні класу A приймали значення 1?
java.lang.Object
+ - java.lang.Throwable
+ - java.lang.Exception
+ - java.lang.RuntimeException
+ - java.lang.IndexOutOfBoundsException
+ - java.lang.StringIndexOutOfBoundsException
+ - java.lang.ArrayIndexOutOfBoundsException
У методі testSomеValue
можуть бути порушені виключення StringIndexOutOfBoundsException і
ArrayIndexOutOfBoundsException , при цьому вони не обробляються в блоці try – catch .
Які з перерахованих нижче тверджень будуть вірними?
(Java)
(Java)
(Java)
(Java)
class Square {
private int s (int a, int b) {
System.out.print (a * b);
return a * b;
}
void s (int r) {
System.out.print (r);
}
}
public class MyClass {
public static void main (String args []) {
Square x = new Square ();
xs (3, 0);
xs (1);
}
}