
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Please use Java to complete the problem in the attatchment. Thank you!
![Write this program using "for-each" loop to get the same output as the "for" loop in below program:
Multidimensional Arrays (2-dimensional array)
package com.cs1131.arrays;
public class TwoDimensionalArrayPrint {
public static void main(String[] args) {
int[][] data = {
{1, -2, 3},
Output:
Row 0: 1
{-4, -5, 6, 9},
{7},
-2 3
};
Row 1: -4
-5 6
9
for (int row = 0; row < data.length; ++row) {
Row 2: 7
System.out.print("Row " + row + ": ");
for(int column = 0; column < data[row].length; ++column) {
System.out.print(data[row][column] + "\t");
System.out.println();
}
}](https://content.bartleby.com/qna-images/question/ea5f6807-db6f-4aec-b8d5-762a824baee4/fec54753-08a8-4622-b830-d01c7d7263e8/wrqm3wk_thumbnail.png)
Transcribed Image Text:Write this program using "for-each" loop to get the same output as the "for" loop in below program:
Multidimensional Arrays (2-dimensional array)
package com.cs1131.arrays;
public class TwoDimensionalArrayPrint {
public static void main(String[] args) {
int[][] data = {
{1, -2, 3},
Output:
Row 0: 1
{-4, -5, 6, 9},
{7},
-2 3
};
Row 1: -4
-5 6
9
for (int row = 0; row < data.length; ++row) {
Row 2: 7
System.out.print("Row " + row + ": ");
for(int column = 0; column < data[row].length; ++column) {
System.out.print(data[row][column] + "\t");
System.out.println();
}
}
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 2 images

Knowledge Booster
Similar questions
- Write one code for it. Write a Comparator in Java to compare two employees based upon their name, departments and age?.arrow_forwardDesign and implement a program that implements Euclid’s algorithm for finding the greatest common divisor of two positive integers. The greatest common divisor is the largest integer that divides both values without producing a remainder. In a class called DivisorCalc, define a static method called gcd that accepts two integers, num1 and num2. Create a driver to test your implementation. The recursive algorithm is defined as follows:gcd (num1, num2) is num2 if num2 <= num1 and num2evenly divides num1gcd (num1, num2) is gcd(num2, num1) if num1 < num2gcd (num1, num2) is gcd(num2, num1%num2) otherwisearrow_forwardCreate a Java project that shows the benefits of using generic types besides the examples from the activity. Summarize your answers and explanation for how your code examples work in 300 wordsarrow_forward
- Generate the Javadoc file for your project?arrow_forwardWrite Java source code to take an integer n and returns the sum of all odd positive integers less than or equals to n. Please implement a sumOddo method for major functionality and a main method with input data for testing cases. Please pay attention to the neat coding style in Java, including grammar, indentations, naming of variables and methods, and comments. a) Conduct an experimental study regarding the running time of your Java code in nanoseconds. Please draw on a separate sheet of paper for the chart/figure on the evaluation results.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY