logo

Crowdly

Browser

Add to Chrome

Програмування мовою Java

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)

0%
View this question
Припустимо, ви моделюєте автомобіль, описуючи його властивості в форматі Java-класу. які з

наступних полів потрібно оголосити статичними?

(Java)

View this question
Які твердження щодо полів класу вірні?

(Java)

0%
0%
0%
0%
0%
View this question
Наступний фрагмент програми завершився помилкою. Які зміни необхідні, щоб програма виводила на екран послідовність 01222?

1 int i = 0;

2 while (i <3) {

3 System.out.print (i);

4 if (i> 1)

5 try {

6 throw new ArithmeticException ( "ex");

7 }

8 finally {

9 System.out.print (i);

10 }

11 catch (ArithmeticException e) {

12 System.out.print (i);

13 break;

14 }

15 i ++;

16 }

0%
0%
0%
0%
View this question
У програмі наведено таке опис класу Shape:

abstract class Shape {

double square;

abstract public void setSquare (double s);

}

Які нижчеперелічені фрагменти коду допустимі?

View this question
Що буде виведено на екран в результаті виконання наступного фрагмента програми?

int a = 12;

int i = 4;

try {

while (i> 0) {

System.out.print (a / i);

i--;

}

}

finally {

System.out.print (i);

}

0%
0%
View this question
Яку перевагу надає інтерфейс Runnable

в порівнянні з класом Thread ?

(Java)

View this question
Яким буде результат роботи наступного коду?

public abstract class SomeClass implements Runnable {

private Object lock = new Object ();

public void lock () {

synchronized (lock) {

try {

lock.wait ();

System.out.print ( "1");

} Catch (InterruptedException e) { }

}

}

public void notifyThread () {

synchronized (lock) {

lock.notify ();

}

}

public void unlock () {

synchronized (lock) {

lock.notify ();

System.out.print ( "2");

}

}

public static void main (String s []) {

SomeClass c = new SomeClass () {

public void run () {

lock ();

}

};

SomeClass c1 = new SomeClass () {

public void run () {

unlock ();

}

};

new Thread (c) .start ();

new Thread (c1) .start ();

c.notifyThread ();

}

}

(Java)

0%
0%
View this question
B програмі описаний клас А і його спадкоємець клас B:

1 class A {

2 int a;

3 int b;

4 }

5 class B extends A {

6 int b;

7 ...

8 }

Яким кодом необхідно доповнити рядок 7, щоб в класі B змінна b класу А встановлювалася рівною 1?

View this question
Які з перерахованих методів класу A є перевантаженими?
0%
0%
0%
View this question

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