Getting error on printing array

后端 未结 4 569
孤独总比滥情好
孤独总比滥情好 2021-01-28 12:22

I got this code:

import java.util.*;
import java.io.*;

public class Oblig3A{
    public static void main(String[]args){
    OrdAnalyse O = new OrdAnalyse();
            


        
4条回答
  •  滥情空心
    2021-01-28 13:17

    Use Arrays.toString() to log your Array's contents

    System.out.println(Arrays.toString(ordArray));
    

    If you want a formatted output you need to iterate over it using a good old for loop.

    for (int i = 0; i < ordArray.length; i++) {
       System.out.printf("ordArray[%d] = %s", i, ordArray[i]);
    }
    

提交回复
热议问题