1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
UNO [17]
3 years ago
10

Print the two strings in alphabetical order. Assume the strings are lowercase. End with newline. Sample output: capes rabbits im

port 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; }}
Computers and Technology
1 answer:
ValentinkaMS [17]3 years ago
4 0

Answer:

Following are the code to the given question:

import java.util.Scanner;//import package

public class OrderStrings // defining a class OrderStrings  

{

   public static void main(String[] args) //defining a main method

   {

       Scanner scnr = new Scanner(System.in);//defining a Scanner class object  

       String firstString;//defining a String variable

       String secondString; //defining a String variable

       firstString = scnr.next();//input value

       secondString = scnr.next();//input value

       if (firstString.compareTo(secondString) < 0)//use if to compare sting value

           System.out.println(firstString + " " + secondString);//print sting value  

       else//else block

           System.out.println(secondString + " " + firstString);//print sting value

   }

}

Output:

rabbits capes

capes rabbits

Explanation:

In this code a class "OrderStrings" is defined inside the class the main method is defined that declares the two string variable that uses the input method to input the string value and after input, it uses the conditional statement. Inside this compareTo method is declared that compare string value and prints the string value.

You might be interested in
What best Describes algorithm bias
blagie [28]

Answer:

E

Explanation:

cause e

8 0
3 years ago
In three to five sentences, explain the function of the computer's operating system.
Sati [7]

Answer:

An Operating System (OS) is an interface between a computer user and computer hardware. An operating system is a software which performs all the basic tasks like file management, memory management, process management, handling input and output, and controlling peripheral devices such as disk drives and printers.

Explanation:

3 0
3 years ago
CORRECT ANSWER GETS BRAINLIEST
guajiro [1.7K]

I saw that all of them are correct. In 1905, the Wright Brothers flew their plane for 39.5 minutes. In 1969, Neil Armstrong landed on the moon. And the Wright brothers went throughout the U.S and Europe to demonstrate their plane. I hope this helps.

7 0
3 years ago
Read 2 more answers
Given the following word addresses: 3, 180, 43, 2,191, 88, 190, 14, 181, 44, 186, 253
professor190 [17]

Answer:

A. index bits = 2, tag bits = 2, block offset bits = 1, it is a miss.

B. index bits = 2, tag bits = 1, block offset bits = 0, it is a hit

C. the miss rate is 0

Explanation:

a. number of blocks = 12

number of blocks per set = 3

number of set = number of blocks / number of blocks per set = 12/3 = 4

word size = 24

block size = 2

the block offset = log_{2} block size

   = log_{2} 2 = 1

the index bits = log_{2} number of set = log_{2} 4 = 2

the tag bits = (log_{2} word size) - offset - index = (log_{2} 24) -2 - 1 = 5 -2 - 1 = 2

b. word size = 8

block size = 1

the block offset = log_{2} block size

   = log_{2} 1 = 0

the index bits = log_{2} number of set = log_{2} 4 = 2

the tag bits = (log_{2} word size) - offset - index = (log_{2} 8) -2 - 1 = 3 - 0- 2= 1

7 0
3 years ago
What is one of the limitations of marketing in social media?.
klemol [59]

One of the limitation of the social media marketing is the risk of negative comments that can hamper the marketing strategy and certainly hamper the sales.

<h3>What is marketing?</h3>

Marketing can be defined as the advertising of the services or products into the market for making the end user aware about the product. There are various marketing tricks that can help in increasing the sales of the products or services.

Learn more about marketing, here:

brainly.com/question/13414268

#SPJ1

3 0
2 years ago
Other questions:
  • Jesse is writing a physics quiz about the motion of a roller coaster cart. He has a clip art illustration of a cart rolling hori
    9·2 answers
  • References are usally innocuous because they are the least personal and direct of the four reference types
    5·1 answer
  • Operating systems are designed to work with specific hardware. Which operating system works with Apple computers?
    8·2 answers
  • Uugurfofyhjfsjvrdjctstghfjddd
    13·1 answer
  • In object-oriented development, why is it necessary to use drivers and stubs in testing?
    9·1 answer
  • have you ever had to adjust your communicatio style to egage a customer or roommate? what was the situation and outcome?
    5·1 answer
  • Which of the following protocols help IP in multicast service?
    9·2 answers
  • Please help, you don’t have to answer it i just need to know the best types of conversions
    12·1 answer
  • .WAP to enter monthly sale of Salesman and give him commission i.E. If the monthly sale is more than 500000 then commision will
    6·1 answer
  • In what year was the earliest documented use of the word computer?.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!