public class Main { public static void main(String args[]) { String[] temp = "A.B.BB".split("\\.", 2); for (String s: temp){ System.out.println(s); } } }