You are viewing a single comment's thread. Return to all comments →
I have an idea that don't need any condition statement
Scanner sc=new Scanner(System.in); String A=sc.next(); String B=sc.next(); Map<Boolean, String> yesNoMap = new HashMap<>(){{ put(true, "Yes"); put(false, "No"); }}; System.out.println(A.length() + B.length()); System.out.println(yesNoMap.get(A.compareTo(B) > 0)); System.out.println(capitalize(A, 0, 1) + " " + capitalize(B, 0, 1)); } private static String capitalize(String s, int from, int to) { return s.substring(0, from) + s.substring(from, to).toUpperCase() + s.substring(to); }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Strings Introduction
You are viewing a single comment's thread. Return to all comments →
I have an idea that don't need any condition statement