Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java print 2d array as table

static void debugV2(Object... obj) {
        System.out.println(Arrays.deepToString(obj)
                .replace("],", "
").replace(",", "	")
                .replaceAll("[[]]", " "));
    }

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj).replace("], ", "]
"));
    }
Comment

java print 2d array row and column

public class TwoDimensionalArrays
{
public static void main (String args[])
{
    final int size1 = 2, size2 = 4, size3 = 5;
    int [][] numbers = {{20,25,34,19,33}, {11,17,15,45,26}, {27,22,9,41,13}};        
    int row = 0, col = 0;

        for(row = 0; row <= size1; row++); //loops through rows
        {
            for(col = 0; col <= size2; col++); //loops through columns
            {
                System.out.println(numbers[row][col]);
            }
        System.out.print("
"); //takes a new line before each new print
        }
    }
 }
Comment

PREVIOUS NEXT
Code Example
Java :: minecraft detect specific item in chest with custom name 
Java :: Calendar ranges java 
Java :: ArrayList of prime numbers 
Java :: startactivity not working in android adapter 
Java :: java stream inner join two lists 
Java :: org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:876) 
Java :: Stop gninnipS My sdroW! javascrip codewars 
Java :: osmdroid get current zoom level 
Java :: java code for scientific calculator GUI 
Java :: default case in Java switch-case 
Java :: jsp check if request parameter exists 
Java :: how to disable text field java 
Java :: thread in java 
Java :: Data provider using junit 
Java :: java synchronized method 
Java :: foreach skip to next java 
Java :: java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider 
Java :: Implement the static keyword – static variable, static block, static function and static class with following conditions 
Java :: onclick listview javafx 
Java :: difference between linkedlist and arraylist 
Java :: Retrieve User information in Spring Security 
Java :: miles to km converter programm in java 
Java :: java try...catch 
Java :: HOW TO START ACTIVITY FROM FRAGMENT INSIDE? 
Java :: intersection of two arrays java 
Java :: java questions 
Java :: java int 0/0 
Java :: Set icon for toolbar android 
Java :: get value from Spring application.properties 
Java :: data structures in java 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =