1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lena [83]
3 years ago
9

Data hiding, which means that critical data stored inside the object is protected from code outside the object, is accomplished

in Java by: A. using the public access specifier on the class methods B. using the private access specifier on the class methods C. using the private access specifier on the class definition D. using the private access specifier on the class fields
Computers and Technology
1 answer:
algol [13]3 years ago
7 0

Answer:

Option (D) using the private access specifier on the class fields

Explanation:

  • The private access modifier can be used to hide the data.
  • Methods and data variables ( fields ) can be declared with the private access modifier.
  • Data hiding is a OOPS Concept which can be achieved with the private keyword (private access modifier).
  • The access modifiers are of types Public, Private, Protected and Default ( no access modifier - no need to explicitly specify the default keyword).
  • Data hiding means to hide the data, the data is contained in the class variables.So, option (d) using private access modifier on the class fields is correct option.
  • Option (A) is wrong as the using the public access modifier doesn't hide anything. It is public and is visible to the public.
  • Option (B) is wrong as using the private access modifier on the methods means it is hiding the implementation of the methods not the data.
  • Option (C) is wrong as using private access modifiers on class definition means making the classes not visible to other classes it doesn't mean data hiding as the data is contained in the class variables.
You might be interested in
Front office employees at the Melville Lodge use a computer-based system to manage, among other things, the central reservation
Step2247 [10]

Answer:

Property Management System

Explanation:

A property management system (PMS) is a software sytem used for the operations of hospitality properties and manufacturing industries sometimes.

6 0
4 years ago
Create an application containing an array that stores 10 integers. The application should call five methods that in turn (1) dis
tensa zangetsu [6.8K]

Answer:

  1.     public class Main {
  2.    public static void main(String[] args) {
  3.        int myArray[] = {3, 7, 2, 5, 9,11, 24, 6, 10, 12};
  4.        int myArray2 [] = {1, 2, 3, 4 ,5};
  5.        displayValue(myArray);
  6.        reverseDisplay(myArray);
  7.        displaySum(myArray);
  8.        displayLess(myArray, 10);
  9.        displayHighAvg(myArray);
  10.        displayBoth(myArray, myArray2);
  11.    }
  12.    public static void displayValue(int arr[]){
  13.        for(int i = 0; i < arr.length; i++){
  14.            System.out.print(arr[i] + " ");
  15.        }
  16.        System.out.println();
  17.    }
  18.    public static void reverseDisplay(int arr[]){
  19.        for(int i = arr.length-1; i >= 0; i--){
  20.            System.out.print(arr[i] + " ");
  21.        }
  22.        System.out.println();
  23.    }
  24.    public static void displaySum(int arr[]){
  25.        int sum = 0;
  26.        for(int i = 0; i < arr.length; i++){
  27.            sum += arr[i];
  28.        }
  29.        System.out.println(sum);
  30.    }
  31.    public static void displayLess(int arr[], int limit){
  32.        for(int i = 0; i < arr.length; i++){
  33.            if(arr[i] < limit){
  34.                System.out.print(arr[i] + " ");
  35.            }
  36.        }
  37.        System.out.println();
  38.    }
  39.    public static void displayHighAvg(int arr[]){
  40.        int sum = 0;
  41.        for(int i = 0; i < arr.length; i++){
  42.            sum += arr[i];
  43.        }
  44.        double avg = sum / arr.length;
  45.        for(int i = 0; i < arr.length; i++){
  46.            if(arr[i] > avg){
  47.                System.out.print(arr[i] + " ");
  48.            }
  49.        }
  50.        System.out.println();
  51.    }
  52.    public static void displayBoth(int arr1[], int arr2 []){
  53.        for(int i = 0; i < arr2.length; i++){
  54.            for(int j = 0; j < arr1.length; j++){
  55.                if(arr1[j] == arr2[i]){
  56.                    System.out.print(arr1[j] + " ");
  57.                }
  58.            }
  59.        }
  60.        System.out.println();
  61.    }
  62. }

Explanation:

There are five methods written to solve all the problems stated in the question.

Method 1 : displayValue    (Line 15 - 21)

This is the method that take one input array and use the print() method to display the all the elements in the array.

Method 2: reverseDisplay (Line 23 - 26)

This method will take one input array and print the value in the reverse order. We just need to start with the last index when running the for-loop to print the value.

Method 3: displaySum (Line 31 - 37)

This method will take one input array and use a for-loop to calculate the total of the values in the array.

Method 4: displayLess (Line 39 - 47)

This method will take one two inputs, a array and a limit. We use the limit as the condition to check if any value less than the limit, then the value will only be printed.

Method 5: displayHighAvg (Line 50 - 64)

This method will take one input array and calculate the average. The average will be used to check if any element in the array higher than it, then the value will only be printed.

Method 6: displayBoth  (Line 66 - 75)

This method will take two input arrays and compare both of them to find out if any value appears in both input arrays and print it out.

3 0
3 years ago
Write down the result of each expression in the output column and specify the datatype of the result.Datatype should follow the
sergiy2304 [10]

Answer:

Kindly check the explanation section.

Explanation:

Below are the expression given in the question and the corresponding output and Datatype.

(1). Expression = 7/2 + 9.2/2.

Output = 7.6, Datatype = double

(2). Expression = 3.4 + 2 5 f.

Output = 5.9, Datatype = double.

(3). Expression = "whale" . Substring (2,5).

Output = "ale" , Datatype = string.

(4). Expression= (int) 9.2 + 6.0 f.

Output = 15.0 f, Datatype = float.

(5). Expression = (2 <= 1) && (5! = 2) || (8 + 5!= 13).

Output = false, Datatype = boolean

(6) Expression =1.5 f == 1.5?.

Output: “false” , Datatype : “true ”

Output = “false”,

Datatype= String.

(7). Expression = “joey”.charAtt(4).

Output = error, Datatype = error“.

(8). Expression = madmax”.

indexOf(“a”) + 7.

Output: 8 , Datatype = int.

(9). Expression = 2 + 3 + “catdog” + 1 + 2.

Output = “5catdog12”, Datatype = String.

(10). Expression = String.format(“%3.3f”,7.89672).

output = “7.897”, datatype = String.

(11). Expression = “captain”.indexOf(“a”, 2).

Output = 4, datatype = int.

(12). true ? ++3: 3++.

Output = error, dataty = error.

(13). Expression = new String[]{“tony”,“josh”}[0].

Output = “tony”, Datatype = String.

(14). Expression = “patrick”.substring(2) +“lucky”.substring(4).

Output = “tricky”, Datatype = String.

(15). Expression = “popFizz”.indexOf(“o”) + 2.4+ 6L.

Output9.4, Datatype = double.

(16). Expression = “pizza”.indexOf(“z”).

Output = 2, Datatype = int.

3 0
3 years ago
A regional bank implemented an automated solution to streamline their operations for receiving and processing checks/cheques. Th
Sphinxa [80]

Answer: Machine learning

Explanation:

The technology that could be combined with the current solution to do this is the machine learning.

Machine learning refers to the use and development of the computer systems which can learn and adapt without them following explicit instructions. This is done through the use of statistical models and algorithms in order to analyse inferences from the patterns in data.

Since the bank wants to streamline their operations for the receiving and processing checks while also enhancing the solution to recognize signs of potential check fraud, then the machine learning can be used.

3 0
3 years ago
Complete the following statement: Sustainability is: Choose all that apply.This task contains the radio buttons and checkboxes f
const2013 [10]

Answer:

E. Leading the way to a new kind of future for the environment, the economy, and society.

Explanation:

We can look at Sustainability to mean the way of meeting our own needs without compromising the ability of future generations to meet their.

In sustainability the focus is not on the now only, rather it puts into consideration the fate the future generation will face.

Hence, it is Leading the way to a new kind of future for the environment, the economy, and society.

8 0
4 years ago
Other questions:
  • What was the name of the system developed by Frederick Winslow Taylor, in which mass production is tied to the cultivation of ma
    10·1 answer
  • Which device prints large, three-dimensional high-quality color graphics?
    15·1 answer
  • The Outline tab and the Slides tab can be open at the same time.
    7·1 answer
  • In this lab you are asked to declare two variables of type integer: userNum and x. The user should input should be stored using
    8·1 answer
  • Write a computer program that computes the duration of a projectile’s flight and its height above the ground when it reaches the
    11·1 answer
  • What are the five Ws?<br> (I don’t even know what this means)
    5·2 answers
  • Fill _________ skips the Saturday and Sunday dates in a date fill.
    10·1 answer
  • Jabari created new video game for his coding course. What is one way he should format his pseudocode?
    12·1 answer
  • Difine Mainframe Computer~<br><br><br><br><br><br><br><img src="https://tex.z-dn.net/?f=%20%5C%3A%20%20%5C%3A%20" id="TexFormula
    12·2 answers
  • Write pseudo code that performs the following: Ask a user to enter a number. If the
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!