Menu
Topics Index
...
`

Break Iterator Variables And Methods


If you need explanation Read this topic

If you need Answer Take test on this topic

Break Iterator Variables And Methods
What is the output of the following program?
import java.util.*;
import java.text.*;
public class DailyDoseA {
    public static void main(String[] arg) throws Exception {
        BreakIterator iterator = BreakIterator.getCharacterInstance(Locale.ENGLISH);
        iterator.setText("india");
        for (int index = iterator.first(); index != BreakIterator.DONE; index = iterator.next()) {
            System.out.print(index);
        }
    }
}

A. 01234
B. 012345
C. 12345
D. Compilation Error or Runtime Error
Topic: Other Advanced Topics In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

B

Posted by Khalid Ahmed    2014-07-21 13:02:47


ANS is B
Because A BreakIterator has an imaginary cursor that points to the current boundary in a string of text...and as "india" it will initially point to 0 then go on moving as per no of letters i.e. 0 1 2 3 4 5

Posted by Mânïshå Mùlchåndânï    2014-07-21 16:27:46


B

Posted by Haseeb Baig    2014-07-21 17:54:49


Congratulations Mânïshå Mùlchåndânï. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-07-22 04:28:12


© meritcampus 2019

All Rights Reserved.

Open In App