Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

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]
    }
}
Comment

how to print an array in java

int[] myArray = {0, 1, 2, 3};
System.out.println(Arrays.toString(myArray));
//prints [0, 1, 2, 3]
Comment

print an array java

public class Array {

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

        for (int element: array) { //Advanced For Loop (For each)
            System.out.println(element); //print each element of 
          							     //the array for each iteration
        }
    }
}
Comment

how to print a array js

var array = [1,2,3]

for(var i = 0; i < array.length ; i++){
    console.log(array[i])
}
Comment

how to print an array in java

Arrays.toString(array)
Comment

print array

// Array of primitives:
int[] intArray = new int[] {1, 2, 3, 4, 5};
//output: [1, 2, 3, 4, 5]

// Array of object references:
String[] strArray = new String[] {"John", "Mary", "Bob"};
//output: [John, Mary, Bob]
Comment

PREVIOUS NEXT
Code Example
Java :: how to count an replace substring string in java 
Java :: joptionpane 
Java :: how to check my java heap space size 
Java :: java log2 
Java :: java get current time in seconds 
Java :: minecraft chunk size 
Java :: android studio list of strings 
Java :: loop will array length java example 
Java :: nginx change root directory 
Java :: import random java 
Java :: java rock paper scissors 
Java :: java get classname 
Java :: sort list of strings java 
Java :: iterating over a hashmap 
Java :: language of minecraft 
Java :: object to string in java 
Java :: java random uuid 
Java :: delay a function call in java 
Java :: android toast message 
Java :: java remainder sign 
Java :: javafx how to change shape color 
Java :: java separate the numbers from string 
Java :: slice a list java 
Java :: toCharArray() method java 
Java :: larger number in java than long 
Java :: java terminal colors 
Java :: how to add two numbers in java 
Java :: convert int to ascii java 
Java :: java distinct by key 
Java :: java create map 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =