Answer:
I. The class methods and instance methods of one class may call the public class methods of another class using dot notation and referencing the name of the other class.
Explanation:
Private methods are being accessed from only within the class or scope specified. No other means of accessibility is possible, and even through inheritance. And instance methods can never call without using dot notation, any of the class method of the same class. Hence second and third options are not correct. And the class method and the instance methods of one class may call the public class methods of another class using the dot notation and referencing the name of the other class. Hence, the correct option is the first one.
The difference between a calculator and a computer is that when a calculator performs computations it is slower but needs more human assistance - C.
While a computer on the other hand, computes tens of thousands of computations without any human input, all done automatically.
Answer:
The code to this question can be given as:
Code:
public class Book //define class.
{
private String title, author; //define variable.
Book(String a, String b) //define parameterized constructor.
{
title = a; //holding value.
author = b;
}
public String toString() //string function
{
return title + "\n" + author; //return value.
}
}
Explanation:
In the above java code firstly we declare the class book that name is already given in the question. Then we declare the private variable that datatype is string author and title. Then we declare the parameterized constructor. In the parameterized constructor we use the private variable for hold constructor parameter value. Then we declare the tostring() function in this function we return value of the title and author variable.
Answer:
b. selection sort
b. 8 11 17 30 20 25
Explanation:
The options above are the correct answers to the given questions.
Selection sort is a simple comparison-based sorting algorithm.
selection sort. (algorithm) Definition: A sort algorithm that repeatedly searches remaining items to find the least one and moves it to its final location. The run time is Θ(n²), where n is the number of elements. The number of swaps is O(n).
It is this sorting algorithm that will best ne suitable in the given event.