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
vikavrn90
Posts: 3
Joined: Fri Aug 14, 2020 9:08 pm
Contact:

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

Post by vikavrn90 »

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

Answer:
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

admin
Site Admin
Posts: 10043
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

please check this thread:
viewtopic.php?f=2&t=964&p=19849
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 25 guests