subject

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: } }import java. util. Scanner;public class OrderStrings { public static void main(String[] args) { String firstString; String secondString; firstString = "rabbit"; secondString= "capes"; //String class in java provide string comparison function, use it, and get //your work done may even use brute force i. e using for loop and compare character by // character which will not good for the programming language which already have vast //predefined number of functions if(firstString. compareTo(secondString) < 0){ System. out. println(firstString + " " + secondString); } else{ System. out. println(secondString + " " + firstString); } return; }}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:10, Tatertotzzzz
Write a method that accepts a string object as an argument and returns the number of words it contains. for instance, if the argument is "four score and seven years ago", the method should return the number 6. demonstrate the method in a program that asks the user to input a string and then passes that string into the method, printing out whatever the method returns.
Answers: 3
image
Computers and Technology, 22.06.2019 12:40, dkjfghdjk
In a response of approximately 50 words, explain why it would be essential for the successful a/v technician to participate in additional coursework, presentations and seminars offered by equipment manufacturers as well as annual conferences attended by colleagues in the industry.
Answers: 1
image
Computers and Technology, 23.06.2019 03:00, tay9122
Jason, samantha, ravi, sheila, and ankit are preparing for an upcoming marathon. each day of the week, they run a certain number of miles and write them into a notebook. at the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. write a program to them analyze their data. your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (you may assume that the input data is stored in a file and each line of data is in the following form: runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)
Answers: 3
image
Computers and Technology, 23.06.2019 04:31, legendman27
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
You know the right answer?
Print the two strings in alphabetical order. Assume the strings are lowercase. End with newline. Sam...

Questions in other subjects: