You are viewing a single comment's thread. Return to all comments →
Scanner scanner=new Scanner(System.in); int wordsize=0; int result=0; String Firstlettercaps=""; String Secondlettercaps=""; String word1=scanner.next(); String word2=scanner.next(); wordsize= word1.length()+word2.length();//Output 1
System.out.println(wordsize); result=word1.compareTo(word2); if(result<=0){ System.out.println("No"); } else if(result > 0){ System.out.println("Yes"); //Output 2 } Firstlettercaps=word1.substring(0, 1).toUpperCase()+word1.substring(1); Secondlettercaps=word2.substring(0, 1).toUpperCase()+word2.substring(1); System.out.println(Firstlettercaps+" "+Secondlettercaps); //Output 3 }
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 →
Scanner scanner=new Scanner(System.in); int wordsize=0; int result=0; String Firstlettercaps=""; String Secondlettercaps=""; String word1=scanner.next(); String word2=scanner.next(); wordsize= word1.length()+word2.length();//Output 1