Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Instructions:There are three lines of output: (JAVA exercise) 1) For the first l

ID: 3728649 • Letter: I

Question

Instructions:There are three lines of output: (JAVA exercise)
1) For the first line, sum the lengths of  and .
2) For the second line, write Yes if  is lexicographically larger than  or No if it is not.
3) For the third line, capitalize the first letter in both  and  and print them on a single line, separated by a space.:

public class Solution {

public static void main(String[] args) {
  
Scanner sc=new Scanner(System.in);
String A=sc.next();
String B=sc.next();
/* Enter your code here. Print output to STDOUT. */   
  
  
}
}

Explanation / Answer

import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String A=sc.next(); String B=sc.next(); /* Enter your code here. Print output to STDOUT. */ System.out.println("The length of first string : " + A.length() + ", the length of second string : " + B.length()); if(A.compareTo(B) < 0) System.out.println("Yes"); else System.out.println("No"); A = Character.toUpperCase(A.charAt(0)) + A.substring(1); B = Character.toUpperCase(B.charAt(0)) + B.substring(1); System.out.println(A + " " + B); } }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote