About Question enthuware.ocpjp.i.v11.2.852 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
Posts: 3
Joined: Fri Aug 14, 2020 9:08 pm

About Question enthuware.ocpjp.i.v11.2.852 :

Post by vikavrn90 »

What will the following code print? System.out.println("12345".charAt(6));

It will throw an IndexOutOfBoundsException

but IntelliJ IDEA give output:

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 6
at java.lang.String.charAt(String.java:658)
at home.Test.main(Test.java:17)

What is right ?
Thank you for helping

Site Admin
Posts: 8943
Joined: Fri Sep 10, 2010 9:26 pm

Re: About Question enthuware.ocpjp.i.v11.2.852 :

Post by admin »

please check this thread:
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests