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!

Яке правило виконання

рекурсивного методу не дотримано в наведеному фрагменті коду

public class Recursion {

     int recursion(int i) {

           int res;

res = recursion (i - 1) + 1;

           return res;

     }

}

View this question

Результат компіляції програмного коду:

public class One {

 

       double a;

 

       One(double a) {

             this.a = a;

       }

 

       void volume(double b) {

             double c = Math.pow(a, b);

             System.out.println(c);

       }

}

 

public class OneMain {

 

       public static void main(String[] args) {

             One one = new One(5);

             One two = new One(2);

             one.volume(2);

             two.volume(3);

       }

}

View this question

Результат компіляції програмного коду:

public class TestMethod {

     int a;

 

     TestMethod(int i) {

           a = i;

     }

 

     TestMethod method () {

           TestMethod temp = new TestMethod(a * 2);

           return temp;

     }

}

 

public class TestMain {

     public static void main(String []args) {

           TestMethod ob1 = new TestMethod(10);

           TestMethod ob2;

           ob2 = ob1.method ();

           System.out.println(ob1.a);

           System.out.println(ob2.a);

 

           ob2 = ob2.method ();

           System.out.println(ob2.a);

     }

}

0%
0%
0%
0%
View this question

Зазначте помилку компіляції частини

програмного коду, що передбачає використання методу із параметрами динамічної

довжини з наступним оголошенням:

int doIt (int a, int b, int ...vals, double c)

0%
0%
0%
0%
View this question

Вкажіть вірну форму подання методу, що приймає параметри:

View this question

Скільки разів метод volume()

може бути викликаним у класі

Main:

class Class {

     double a;

 

     Class (double a){

           this.a = a;

}

 

     void volume(double b

) { 

           double c = Math.pow(a, b);

System.out.print(c);

     }

}

 

class Main {

     public static void main(String[] args) {

 

           Class class = new Class(5);

           class.volume(2);

     }

}

View this question

Чи має тип даних, який повертає метод, бути сумісним з типами, що

використовуються у тілі методу?

View this question

Вкажіть вірну конструкцію методу, що приймає динамічну кількість параметрів

(аргументи динамічної довжини):

0%
0%
0%
0%
View this question

Які типи даних можливо передавати методам в

якості параметрів?

0%
0%
0%
View this question

Результат

компіляції програмного коду:

public class One {

       int a, b;

 

       One(int i, int j) {

             a = i;

             b = j;

       }

 

       void meth(One o) {

             o.a *= 2;

             o.b /= 2;

       }

}

 

public class OneMain {

 

       public static void main(String[] args) {

             One one = new One(2, 4);

      

             System.out.println(one.a + " " + one.b);

 

             one.meth(one);

             System.out.println(one.a + " " + one.b);

       }

}

0%
0%
0%
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