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

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,855 questions

51,776 answers

573 users

How to use try catch in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        try {
            int[] arr = {1, 2, 3, 4, 5, 6, 7};
              
            for (int n : arr) {
                System.out.println(n);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}




/*
run:

1
2
3
4
5
6
7

*/

 



answered Apr 3, 2021 by avibootz

Related questions

1 answer 148 views
148 views asked Jul 11, 2022 by avibootz
2 answers 269 views
1 answer 155 views
155 views asked Oct 5, 2019 by avibootz
1 answer 190 views
1 answer 168 views
168 views asked Dec 17, 2016 by avibootz
1 answer 177 views
177 views asked Dec 17, 2016 by avibootz
1 answer 117 views
117 views asked Oct 8, 2022 by avibootz
...