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
mestny [16]
3 years ago
10

Write a method that accepts a String object as an argument and displays its contents backward. For instance, if the string argum

ent is "gravity" the method should display "ytivarg". Demonstrate the method in a program that asks the user to input a string and then prints out the result of passing the string into the method.
Computers and Technology
1 answer:
Nata [24]3 years ago
6 0

Answer:

// importing the necessary libraries

import java.util.Scanner;

public class BackwardString {

public static void main(String[] args) {

String input;

// Scanner object to read string from user input

Scanner scanner = new Scanner(System.in);

System.out.print("Enter String here : ");

input=scanner.next();

// calling backward method to reverse passed string

backward(input);

// closing Scanner object

scanner.close();

}

// Method to Reverse the input string

private static void backward(String source) {

int i, len = source.length();

StringBuilder dest = new StringBuilder(len);

for (i = (len - 1); i >= 0; i--){

dest.append(source.charAt(i));

}

System.out.println("Reversed String : "+dest);

}

}

Explanation:

// importing the necessary libraries

import java.util.Scanner;

public class BackwardString {

public static void main(String[] args) {

String input;

// Scanner object to read string from user input

Scanner scanner = new Scanner(System.in);

System.out.print("Enter String here : ");

input=scanner.next();

// calling backward method to reverse passed string

backward(input);

// closing Scanner object

scanner.close();

}

// Method to Reverse the input string

private static void backward(String source) {

int i, len = source.length();

StringBuilder dest = new StringBuilder(len);

for (i = (len - 1); i >= 0; i--){

dest.append(source.charAt(i));

}

System.out.println("Reversed String : "+dest);

}

}

The program above accepts a String object as an argument and displays its contents backward.

It reverses the any string inputed while producing the output.

You might be interested in
What are Manuscript signs​
mihalych1998 [28]

Answer: See explanation

Explanation:

Manuscript signs, refers to the marks or the symbols that are used within a manuscript in order to show the necessary corrections which should be made during the preparation of a document.

Manuscript formatting is vital as it makes the manuscript easier to assess. In a situation whereby manuscripts are poorly formatted, it can be turned down by agents and publishers.

5 0
2 years ago
For the description below, develop an E-R diagram:
xeze [42]

Answer:

See explaination

Explanation:

E-R diagram:

Entity Relationship Diagram, also known as ERD, ER Diagram or ER model, is a type of structural diagram for use in database design. An ERD contains different symbols and connectors that visualize two important information: The major entities within the system scope, and the inter-relationships among these entities.

Please kindly check attachment for for the ERD of the question asked.

4 0
3 years ago
What the repeal of online privacy protections means for you?
kvv77 [185]
Online Privacy is well, our privacy while on the internet. If they have repealed that, then we have no privacy while on the internet. I feel like now a days there is no privacy at all anywhere. Everywhere you go, there are cameras watching you. So for them to take away online privacy is pretty messed up.
7 0
3 years ago
Anti-lock braking systems can significantly.... a. impede your braking stability. B. improve your braking stability. C. improve
Setler79 [48]
Here is the answer that would best complete the given statement above. Anti-lock braking systems can significantly improve your braking stability. The correct answer would be therefore, option B. Anti-lock braking systems is for safety purposes in order for to prevent <span>the wheels from </span>locking<span> up (ceasing rotation) and avoiding uncontrolled skidding. Hope this answer helps.</span>
7 0
3 years ago
Importancia de la química en la vida cotidiana​
maks197457 [2]

Answer:

chemistry is very important because everything you do is chemistry . our body is made up of chemicals . chemicals reactions occurs when be breathe ,eat , etc . All matter is made of chemicals so that chemistry is very important in our life

5 0
3 years ago
Other questions:
  • Todd, a travel agent, lost his job due to no need for his skill. This is an example of what type of unemployment?
    12·1 answer
  • Which type of movement lets the player control an object's movement?
    5·1 answer
  • Vaporization is the process in which liquid is sufficiently cooled to change states of matter from a liquid to a vapor true or f
    8·1 answer
  • Write a Twitter class that sets the Twitter user first (who is to be followed) and lets the client add up to 5 followers, which
    10·1 answer
  • _________________ ___________________ is an encrypted code that a person, website, or organization attaches to an electronic mes
    9·1 answer
  • The function of the __________ is to on transmission assemble data into a frame, on reception disassemble frame and perform addr
    8·1 answer
  • Is Missouri a free state or a slave state​
    13·2 answers
  • Xercise 1<br>1.<br>What is system? Explain the components of system in brief.​
    12·1 answer
  • Ashley works for a company that helps hospitals hire new doctors. They have written a list of strategies that can be used to int
    12·1 answer
  • Your friend decides to create a spreadsheet containing vocabulary terms and their definitions to help prepare for the unit test
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!