Answers for "how to print array"

41

java how to print an array

import java.util.Arrays;

class Scratch{
    public static void main(String[] args){
        int[] arr = new int[3];
        System.out.println( Arrays.toString( arr ));
      	//prints [0, 0, 0]
    }
}
Posted by: Guest on February-17-2020
34

print in java

//print and create new line after
System.out.println("text");
System.out.println(String);
//You can use any variable type, not just strings, although
//they are the most common

//Print without creating a new line
System.out.print("text");
System.out.print(String);
Posted by: Guest on February-05-2020
10

how to print array elements in java

import java.util.Arrays;

public class Array {

    public static void main(String[] args) {
        int[] array = {1, 2, 3, 4, 5};

        System.out.println(Arrays.toString(array));
    }
}
Posted by: Guest on March-29-2020
4

java how to print a string[]

String[] array = new String[] {"John", "Mary", "Bob"};
System.out.println(Arrays.toString(array)); // [John, Mary, Bob]
Posted by: Guest on March-22-2020
1

how to print array

System.out.println(Arrays.toString(array));
Posted by: Guest on January-05-2021
1

how to print a array js

var array = [1,2,3]

for(var i = 0; i < array.length ; i++){
    console.log(array[i])
}
Posted by: Guest on June-05-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language