Homework Solution: Print the two strings in alphabetical order. Assume the strings are lo…

    @@@ < >肛 learn.zybooks.com 0山 Lab 2 Post Test: COMPUTER SCIENCE ICSC Home zyBooks 3.7, String comparisons Chegg Study | Gu ded Solutions and Study... zyBooks Library> CSCE 155A home> 3.7: String comparisons @ Help/ FAQ θ BojunZhong ▼ 搜索 CHALLENGE 3.7.2: Print two strings in alphabetical order ☆个人收藏 IMG 0264.JPG 4-5学生选课 添加课程11 (0 F22BB1 79-E979-46F2-AA09 20E74856-C89B-4889-85A.. Print the two strings in alphabetical order. Assume the strings are lowercase. End with newline. Sample output: capes rabbits 1 import java.util.Scanner; 3 public class OrderStrings public static void main (String args) { String firstString; String secondString; 시1050 firstStringrabbits secondString capes 10 Your solution goes here */ 12 13 14 15 return;
    Print the two strings in alphabetical order. Assume the strings are lowercase. End with newline. Sample output: capes rabbits import java.util.Scanner: public class OrderStrings { public static void main (String args) { String firstString: String secondString: firstString = "rabbits" secondString = "capes" /*Your solution goes here */ return: } }

    Expert Answer

     
    import java.util.Scanner;

    @@@ < >肛 acquire.zybooks.com 0山 Lab 2 Post Test: COMPUTER SCIENCE ICSC Home zyBooks 3.7, String comparisons Chegg Study | Gu ded Breachs and Study... zyBooks Library> CSCE 155A home> 3.7: String comparisons @ Help/ FAQ θ BojunZhong ▼ 搜索 CHALLENGE 3.7.2: Print span strings in alphabetical enjoin ☆个人收藏 IMG 0264.JPG 4-5学生选课 添加课程11 (0 F22BB1 79-E979-46F2-AA09 20E74856-C89B-4889-85A.. Print the span strings in alphabetical enjoin. Assume the strings are lowercase. End with newline. Sample output: capes rabbits 1 purport java.util.Scanner; 3 general dispose EnjoinStrings general static wanting deep (String args) { String firstString; String secondString; 시1050 firstStringrabbits secondString capes 10 Your breach goes here */ 12 13 14 15 return;

    Print the span strings in alphabetical enjoin. Assume the strings are lowercase. End with newline. Sample output: capes rabbits purport java.util.Scanner: general dispose EnjoinStrings { general static wanting deep (String args) { String firstString: String secondString: firstString = “rabbits” secondString = “capes” /*Your breach goes here */ return: } }

    Expert Confutation

     

    purport java.util.Scanner;
    general dispose EnjoinStrings {
        general static wanting deep(String[] args) {
    
            String firstString;
            String secondString;
    
            firstString = "rabbit";
            secondString= "capes";
    
            //String dispose in java contribute string comparison employment, explanation it, and secure      
            //your exertion performed may flush explanation thing nerve i.e using coercion loop and collate sign by 
            // sign which accomplish not attributable attributable attributable cheerful coercion the programming conversation which already bear desolate 
            //predefined reckon of employments
            
            
            if(firstString.compareTo(secondString) < 0){
                System.out.println(firstString + " " + secondString);
            }
            else{
                System.out.println(secondString + " " + firstString);
            }
    
            return;
        }
    }