GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Java/strings/CharactersSame.java at master · rcfgnu/Java Expand file tree/ Copy pathCharactersSame.javaMore file actions 27 lines (24 loc) · 684 Bytes / Copy pathCharactersSame.javaFile metadata and controls27 lines (24 loc) · 684 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 package strings; public class CharactersSame { /** Driver Code */ public static void main(String[] args) { assert isAllCharactersSame(""); assert !isAllCharactersSame("aab"); assert isAllCharactersSame("aaa"); assert isAllCharactersSame("11111"); } /** * check if all the characters of a string are same * * @param s the string to check * @return {@code true} if all characters of a string are same, otherwise {@code false} */ public static boolean isAllCharactersSame(String s) { for (int i = 1, length = s.length(); i < length; ++i) { if (s.charAt(i) != s.charAt(0)) { return false; } } return true; } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |