Question

**JAVA** what code would you use to print out an empty 10x10 array, so it looks...

**JAVA** what code would you use to print out an empty 10x10 array, so it looks like a grid? I keep getting error messages in my code.  

0 0
Add a comment Improve this question Transcribed image text
Answer #1
public class Grid {

    public static void main(String[] args) {
        int[][] grid = new int[10][10];

        // printing grid..
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j < grid[i].length; j++) {
                System.out.print(grid[i][j] + "\t");
            }
            System.out.println();
        }
    }
}

Add a comment
Know the answer?
Add Answer to:
**JAVA** what code would you use to print out an empty 10x10 array, so it looks...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java code: Use at least one array defined in your code and one array or array...

    Java code: Use at least one array defined in your code and one array or array list defined by user input.    Examples of arrays you can define in code are: A deck of cards, the days of the week, the months of a year. User input can be things like grades, shopping list items, wish lists, deposits an withdrawals, etc. Be able to add, remove, print, sort as necessary to complete the program's goal. Thanks

  • Java code to read from .csv file i currently have a .csv file that looks like...

    Java code to read from .csv file i currently have a .csv file that looks like this: 39.743222, -105.006241, Hospital 39.743981, -105.020017, Home 39.739377, -104.984774, Firehouse 39.627779, -104.839291, McDonald's 39.731919, -104.961814, Chipotle I need to write code to extract the doubles from each line to use for my Linked List. this is what i have so far: Scanner in = new Scanner(new FileInputStream(DATA_FILE));

  • Use Java to implement a basic stack using an array of integers. For the stack, you...

    Use Java to implement a basic stack using an array of integers. For the stack, you will create an array of integers that holds 5 numbers. To make it easier, you can declare the array at the class level. That way you will be able to use the array in any method in your class without using parameters. Your input/output interface should look something like the following: What operation do you want to do? push What number do you want...

  • C++ question: How would I make code that cin a dimension froma user between 3 to...

    C++ question: How would I make code that cin a dimension froma user between 3 to 11 and generate a tic tack toe grid? Should I set my array size to121 (an 11x11 grid) even if I don't use the entire array? Say the grid is only 3x3 then I would technically only use grid spaces 0-8 right? It would look like this: ? | ? | ? ----------- ? | ? | ? ----------- ? | ? | ?

  • This should be in Java Create a simple hash table You should use an array for...

    This should be in Java Create a simple hash table You should use an array for the hash table, start with a size of 5 and when you get to 80% capacity double the size of your array each time. You should create a class to hold the data, which will be a key, value pair You should use an integer for you key, and a String for your value. For this lab assignment, we will keep it simple Use...

  • ***Java Project*** Please upload the entire code and attach the screenshots of the code. The screenshots help me to write the code, so please attach that. Thank you so much. If you could use the comme...

    ***Java Project*** Please upload the entire code and attach the screenshots of the code. The screenshots help me to write the code, so please attach that. Thank you so much. If you could use the comment to explain the code, it would be perfect! Thank you so much~ Design and code a Swing GUl for a two-player tic-tac-toe (noughts and crosses) game on a 3 x 3 game board. The JFrame should use a BorderLayout with a JLabel in the...

  • Simulate how many steps its take a random walker starting at the center of an 10x10...

    Simulate how many steps its take a random walker starting at the center of an 10x10 grid to visit every cell of the grid. If the walker tries to go outside of the grid then it doesn't move in that step. Write a java program which simulates th steps of the random walker, and keeps hold about the grid with 2D boolean array and write out the steps when the random walker have walked all the cells. ----------------------------------------------------------------------------------------------- I have...

  • JAVA Hello, I would like some help wiht this program, I'm not sure hard to code...

    JAVA Hello, I would like some help wiht this program, I'm not sure hard to code the deep copy and array for MenuSchedule Here is my code: Chez Moraine, a fake restaurant known for fine dining at reasonable prices, has hired you to develop a program to manage their menu during peak times: Friday, Saturday, and Sunday nights Below is the UML diagram you will implement. You may also use my specs on the next page as your guide to...

  • I need help with some java code concerning the comparison of two arrays. Let's say I...

    I need help with some java code concerning the comparison of two arrays. Let's say I have two arrays. Array A and Array B. Array A has 7 integers on each line, and there are hundreds of lines. Array B is the same as Array A except every line of integers have been sorted in ascending order. In Array A there are already lines that are sorted, so some lines in Array A will be equal in Array B. What...

  • The following code is a Java code for insertion sort. I would like this code to...

    The following code is a Java code for insertion sort. I would like this code to be modified by not allowing more than 10 numbers of integer elements (if the user enters 11 or a higher number, an error should appear) and also finding the range of the elements after sorting. /* * Java Program to Implement Insertion Sort */ import java.util.Scanner; /* Class InsertionSort */ public class InsertionSortTwo { /* Insertion Sort function */ public static void sort( int...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT