public static void main(String[] args) throws Exception 
    {
        Pattern pattern = Pattern.compile(".");
        Matcher matcher = pattern.matcher("xx.YY.ZZ");
        while (matcher.find())
            System.out.println(matcher.group());
    }