Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,166 questions

40,722 answers

573 users

How to print array in Java

2 Answers

0 votes
public class MyClass {
    public static void main(String args[]) {
        int[] array = {4, 7, 1, 0, 3, 9, 6};

        for (int n: array) {
            System.out.println(n);
        }
    }
}




/*
run:

4
7
1
0
3
9
6

*/

 





answered Jan 14, 2022 by avibootz
edited Jan 15, 2022 by avibootz
0 votes
import java.util.Arrays;

public class MyClass {
    public static void main(String args[]) {
        int[] array = {4, 7, 1, 0, 3, 9, 6};

        System.out.println(Arrays.toString(array));
    }
}




/*
run:

[4, 7, 1, 0, 3, 9, 6]

*/

 





answered Jan 14, 2022 by avibootz
edited Jan 15, 2022 by avibootz

Related questions

1 answer 24 views
2 answers 22 views
2 answers 31 views
2 answers 25 views
25 views asked Sep 30, 2023 by avibootz
6 answers 58 views
...