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!

Вкажіть результат виконання наступного коду?

public class SomeClass {

public static void main (String [] args) {

SomeClass c = new SomeChild1 ();

((SomeClass) c) .print ();

((SomeChild1) c) .print ();

((SomeChild2) c) .print ();

}

public void print () {

System.out.println ( "SomeClass");

}

}

class SomeChild1 extends SomeClass {

public void print () {

System.out.println ( "SomeChild1");

}

}

class SomeChild2 extends SomeClass {

public void print () {

System.out.println ( "SomeChild2");

}

}

(Java)

0%
0%
0%
0%
0%
View this question
Значення якого типу буде зберігати змінна b після ініціалізації?

byte b = 1 + 2;

(Java)

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

public class SomeClass {

static int x;

public static void main (String [] args) {

SomeClass s = new SomeClass ();

s.test (5);

System.out.println (x);

}

private void test (int x) {

x = this.x + 5;

System.out.print (x);

}

}

(Java)

View this question
Вкажіть всі варіанти коду, якими можуть бути додані в п'ятий рядок програми, щоб обчислення площі кола вироблялося коректно?

1 class Square {

2 final double PI = 3.14;

3 double r;

4 double s () {

5 ...

6}

7 ...

View this question
Коректний оголошений нижче клас? Якщо немає, то як його можна виправити?

class Box {

private int weight = 0;

public int getWeight () {

return weight;

}

void setWeight (int weight) {

weight = weight;

}

}

(Java)

View this question
Які символи ви бачите може бути доданий у другому рядку програми, для того, щоб обчислення площі круга було коректним?

1 class Square {

2 ...

3 double r;

4 double s () {

5 return PI * this.r * this.r;

6}

7}

View this question
Які із зазначених конструкторів можуть бути додані в опис класу А ?

class A {

char ch;

int digit;

}

View this question
Дан наступний клас:

class abc.Point {

abc.Point (int a, int b) {

x = a;

y = b;

}

int x, y;

...

}

Який буде результат такого прикладу?

abc.Point p1 = new abc.Point (3, 4);

abc.Point p2 = p1;

p1.x = 5;

p1 = new abc.Point (4, 4);

System.out.print (p2.x - p1.x);

(Java)

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

public class SomeClass {

static int x;

public static void main (String [] args) {

SomeClass s = new SomeClass ();

s.test (5);

System.out.println (x);

}

private void test (int x) {

this.x = x + 5;

System.out.print (x);

}

}

(Java)

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

public class SomeClass {

public static void main (String [] args) {

int i = 0;

while (i <6) {

if (i> 5) i--;

if (i <4) i ++;

if (i = = 5) i ++;

i ++;

System.out.print (i);

}

}

}

(Java)

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