logo

Crowdly

Browser

Add to Chrome

Об'єктно-орієнтоване програмування

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!

Зовнішній

клас має доступ до членів вкладеного класу за умови:

0%
0%
0%
0%
View this question

Чому

метод showy

() не буде компільований

JVM:

class Outer {

     int outer_x = 100;

 

     void

test()

{

           Inner inner = new Inner();

           inner.display();

     }

 

     class Inner {

           int

y = 10; //локальна

змінна класу Inner

           void display() {

                System.out.println(outer_x);

           }

     }

    

void

showy

() {

           System.out.println(y);

     }

}

0%
0%
View this question

Яким

чином з класу нащадка можливо організувати доступ до закритих змінних (

private

)

батьківського класу:

0%
0%
0%
0%
View this question

Яке

ключове слово відповідає за наслідування

0%
0%
0%
0%
View this question

Не

статичний вкладений клас – це:

View this question

Яка стрічка з наведено фрагменту програмного коду не

компілюється у

JVM:

class Box {

     private double width;

     private double height;

     private double depth;

    

     Box (Box ob){

           width = ob.width;

           height = ob.height;

           depth = ob.depth;

     }

    

     Box (double w, double h, double d){

           width = w;

           height = h;

           depth = d;

     }

}

 

public class BoxWeight extends Box {

     double weight;

 

           BoxWeight(BoxWeight ob) {

           super(ob);

           weight = ob.weight;

     }

 

     BoxWeight(double w, double h, double d, double m) {

           super(w, h, d);

           weight = m;

}

}

 

public class BoxWeightDemo

{

 

     public static void main(String[] args) {

           BoxWeight mybox1 = new BoxWeight(10, 20, 15, 34.3);

           BoxWeight mybox2 = new BoxWeight();

           BoxWeight mycube = new BoxWeight(3, 2);

           BoxWeight myclone = new BoxWeight(mybox1);

}

}

0%
0%
0%
0%
View this question

Яку роль відіграє стрічка super(w, h, d); в наведеному фрагменті коду:

public class BoxWeight extends Box {

     double weight;

 

     BoxWeight(double w, double h, double d, double m) {

           super(w, h, d);

           weight = m;

     }

}

View this question

Основна

ідея наслідування полягає у:

0%
0%
0%
0%
View this question

Чи

буде доступний метод

trable() в класі BoxWeight:

class Box {

     double width;

     double height;

     double depth;

 

void trable(){

double c = width+

height

+ depth;

}

}

 

class BoxWeight extends Box {

}

0%
0%
0%
0%
View this question

Чи

являється клас

Inner вкладеним класом:

class Outer {

     int outer_x = 100;

 

     void

test()

{

           Inner inner = new Inner();

           inner.display();

     }

}

class Inner {

     int

y = 10; //локальна

змінна класу Inner

     void

display()

{

           System.out.println(outer_x);

     }

}

0%
100%
0%
View this question

Want instant access to all verified answers on virt.ldubgd.edu.ua?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome