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
olya-2409 [2.1K]
4 years ago
5

Print the two strings in alphabetical order. assume the strings are lowercase. end with newline. sample output: capes rabbits

Computers and Technology
2 answers:
steposvetlana [31]4 years ago
4 0

Here you go,

Program:

import java.util.Scanner;

public class OrderStrings {

    public static void main(String[] args) {

         String firstString;

         String secondString;


         firstString = "rabbits";

         secondString = "capes";

         int status = firstString.compareTo(secondString);


         if(status<0)

         {

              System.out.println(firstString + " " +  secondString);

         }

         else

         {

              System.out.println(secondString + " " + firstString);

         }

         return;

    }

}

s2008m [1.1K]4 years ago
3 0

Answer:

To print the two strings in alphabetical order if the strings are in lower case and end with a new line, first define a class and store the values in string variables. After this, compare the string using compareTo() function and finally print the result.

Further Explanation:

Code: Following is the JAVA code that prints the two strings in alphabetical order where strings are in lower case and end with new line.

import java.util.Scanner;

//definition of the class

public class StringOrder  

{

public static void main(String[] args)  

{

// define the variables

String firstString;

String secondString;

// assign values to the strings

firstString = "rabbits";

secondString = "capes";

// compare the strings

if(firstString.compareTo(secondString)<0)

{

System.out.println(firstString+""+secondString);

}

else

{

System.out.println(secondString+""+firstString);

}

return;

}

Learn more:  

1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011  

2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832  

3. The shape of our galaxy was determined ‘on the inside looking out' by surveying the milky way using ____________ telescopes. brainly.com/question/7866623  

4. List 3 characteristics of the ideal encryption scheme. brainly.com/question/3000161

Answer details:

  • Grade: College Engineering
  • Subject: Computer Science and Engineering
  • Chapter: Java Programming

Keyword:  

Java programming, python, C++, print, two strings, alphabetical order, lower case, upper case, output, capes rabbits, compare, loops, variables, first string, second string, scanner class

You might be interested in
What is the meaning of "At work, I am quite reserved."?
nata0808 [166]
Meaning you are busy and focused at work
5 0
3 years ago
Read 2 more answers
In both direct flooding attacks and _____ the use of spoofed source addresses results in response packets being scattered across
Natali5045456 [20]

Answer:

SYN spoofing attacks.    

Explanation:

The Spoofing attack is used to access the personal information it is distributed the  viruses through infected links or file .The spoofing attacks has redistributed the traffic and the flow control in the denial-of-service attacks.

The SYN spoofing attacks is used the spoofed source in the result of giving response to packet The Spoofing attack  is distributed  across the Internet also it is detectable

6 0
3 years ago
As text is typed in the _____ text box, a drop-down list displays options for completing the action, displaying information on t
pickupchik [31]

Answer:

Excel Help

Explanation:

Press F1 key to open the excel help window

Or you can also click the excel help button to launch the help window.

Type for whatever you are seeking help for and you will notice suggestions as you type something. These suggestions include online and offline results. If there are too many results then try searching offline it will narrow down the results.

After typing the text and hitting enter, the excel help returns several related topics on the searched query. You can browse through these topics and get help from excel.

5 0
3 years ago
Which part of the cpu accepts data?
V125BC [204]

The answer is the Processor register.

5 0
3 years ago
Which function should be used to display a value based on a comparison?
Talja [164]

I think the answer is C.) IF

But im not sure..
. IF() Function Syntax

8 0
4 years ago
Read 2 more answers
Other questions:
  • Java - Given a String variable response that has already been declared, write some code that repeatedly reads a value from stand
    12·1 answer
  • 1.The small company where you work needs to implement a second server for its accounting system but does not have the funds to p
    15·1 answer
  • Run a Monte Carlo simulation on this vector representing the countries of the 8 runners in this race:
    7·1 answer
  • Sarah has entered data about football players from team A and team B in a worksheet. She enters names of players from team A wit
    9·2 answers
  • What is hardware?
    10·1 answer
  • I need your help with the following homework assignment:
    9·1 answer
  • Knowing and understanding the targeted audience is a main compnent to creating a website
    15·1 answer
  • The term wiki refers to a(n): Group of answer choices type of short-message blogging, often made via mobile device and designed
    9·1 answer
  • You must regularly do this on your computer to prevent a virus from infecting it​
    9·2 answers
  • Silicone rubber and urethane caulks generally give the ____________ overall performance for exterior building envelope applicati
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!