Looking for Об'єктно-орієнтоване програмування test answers and solutions? Browse our comprehensive collection of verified answers for Об'єктно-орієнтоване програмування at virt.ldubgd.edu.ua.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Область дії вкладених класів обмежується областю дії:
Модифікатор за замовчуванням надає доступ до членів класу:
З яким модифікатором доступу оголошено змінну three
class One {
private int one;
public int two;
int three;
}
Механізм, що зв’язує код та дані, якими він маніпулює, захищаючи
Помилка компіляції програмного коду
class One {
int one;
static int two = 2;
int three;
public One(int one, int three) {
this.one = one;
this.three = three;
}
static void method() {
int result = one + three;
}
}
Результат компіляції програмного
class One {
int one;
static int two = 2;
int three;
}
public class OneMain {
public static void main(String[] args) {
One one = new One();
one.one = 2;
one.three = 8;
System.out.println(one.three/(One.two*one.one));
}
}
Принципи інкапсуляції реалізуються за допомогою:
Вкажіть помилку компіляції коду
class One {
private int one;
public int two;
int three;
}
public class OneMain {
public static void main(String[] args) {
One one = new One();
one.one = 2;
one.two = 4;
one.three = 8;
}
}
Вкажіть правильну форму оголошення статичного блоку ініціалізації
Помилка компіляції програмного коду:
class One {
int one;
static int two = 2;
int three;
public One(int one, int three) {
this.one = one;
this.three = three;
}
int suma () {
int result = one + three +
return result;
}
static void method() {
int result = suma()/two;
}
}