Answers for "how to display array"

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
0

display elements of the array

$max=sizeof($_SESSION['cart']);
for($i=0; $i<$max; $i++) { 

while (list ($key, $val) = each ($_SESSION['cart'][$i])) { 
echo "$key -> $val ,"; 
} // inner array while loop
echo "<br>";
} // outer array for loop
Posted by: Guest on October-14-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language