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
insens350 [35]
3 years ago
9

What is the printout (display) of the following program? public class Test { public static void main(String[] args) { int[][] va

lues = {3, 4, 5, 1}, {33, 6, 1, 2}; int v = values[0][0]; for (int row = 0; row < values.length; row++) for (int column = 0; column < values[row].length; column++) if (v < values[row][column]) v = values[row][column]; System.out.print(v); } }
Computers and Technology
1 answer:
vodka [1.7K]3 years ago
8 0

Answer:

The printout of the program is 33

Explanation:

Given the code as follows:

  1.        int[][] values = {{3, 4, 5, 1}, {33, 6, 1, 2}};
  2.        int v = values[0][0];
  3.        for (int row = 0; row < values.length; row++)
  4.            for (int column = 0; column < values[row].length; column++)
  5.                if (v < values[row][column])
  6.                    v = values[row][column];
  7.                System.out.print(v);

The code above will find the largest value from the two-dimensional array and print it out.

The logic of finding the largest value is as follows:

  • Create a variable, <em>v</em>, to hold the largest number (Line 2). At the first beginning, we simply set the value from the first row and first column (values[0][0])  as our current largest value.
  • Next, we need to compare our current largest value against the rest of the elements in the two dimensional array.
  • To make the comparison, we need a two-layers for loops that will traverse through every row and column of the array and compare each of the element with the current largest value (Line 3-6).
  • If the current largest value, v, is smaller than any element of the array, update the <em>v</em>  to the latest found largest value (Line 5-6).
  • After completion of the for-loop, the v will hold the largest number and the program will print it out (Line 8).
You might be interested in
What does a class do?
SSSSS [86.1K]

Answer:

adds color to words

Explanation:

adds color to words

7 0
3 years ago
How to change your phone number t mobile?
dexar [7]
U van change it by buying an new Sim card or buy trading it in
8 0
3 years ago
a flow chart is the _______ representation of the sequence of steps required of steps required to solve a particular problem​. I
Eddi Din [679]

Answer:

A flowchart is simply a graphical representation of steps. It shows steps in sequential order and is widely used in presenting the flow of algorithms, workflow or processes. Typically, a flowchart shows the steps as boxes of various kinds, and their order by connecting them with arrows.

7 0
3 years ago
Which computer can perform the single dedicated task? a. Which commuter can perform the function of both analog and digital devi
vredina [299]
<h3>a= hybrid computer can perform the function of both analog and digital computer</h3>
8 0
3 years ago
WHAT IS SQL AND HOW CAN YOU MEET THE DATA REQUIREMENTS ALSO MAINTAINING DATA INTEGRITY,AND LASTLY STATE THE FULL MEANING OF SQL
castortr0y [4]
SQL stands for Structured Query Language, it is a standard query language that is used in a computer usually used for manipulation of data in a system through its database management by using its query codes or commands. It is widely used in database management and manipulation because it use a CRUD query method or Create, Update, Delete and Insert of data in the database.
5 0
4 years ago
Other questions:
  • Identify the function for the following computer part: CD-Drive Question 17 options: A. Storage B. Output C. Input D. Processing
    12·1 answer
  • Tool such as microsoft’s ____ are helping to bridge different platforms and programming languages.
    6·1 answer
  • A ________ editor was the dominant way film was edited up until the early '90s.
    7·2 answers
  • Cloud computing is the fastest growing form of computing. <br> a. True <br> b. False
    9·1 answer
  • Plz help! 3 questions! 1.The ideal light to use is.... A.front light B.a combination of side and back light C.a combination of f
    10·1 answer
  • What is the first thing you should do before constructing a window in the IDE?
    14·1 answer
  • Consider two different implementations of the same instruction set architecture (ISA). The instructions can be divided into four
    14·1 answer
  • Before creating a graphic, you should _____. Select all that apply. A. export it as an SVG file B. consider whe
    12·1 answer
  • Consider the following code and its output:
    15·1 answer
  • Select the correct text in the passage.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!