Java tutorial
//package com.java2s; public class Main { private static boolean isAllWordsAndNo(String middle) { char[] array = middle.toCharArray(); for (Character ch : array) { if (ch < '0' || ch > 'z') { return false; } else if (ch > '9' && ch < 'A') { return false; } else if (ch > 'Z' && ch < 'a') { return false; } } return true; } }