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
Ebay employs the _____ auction mechanism.
myrzilka [38]

Answer:

A. Foward

Explanation:

4 0
3 years ago
Read 2 more answers
explain the following joke: “There are 10 types of people in the world: those who understand binary and those who don’t.”
BigorU [14]

It means that there are people  who understand binary and those that do not understand it. That is, binary is said to be the way that computers are known to express numbers.

<h3>What is the joke about?</h3>

This is known to be a popular  joke that is often  used by people who are known to be great savvy in the field of mathematics.

The joke is known to be one that makes the point that a person is implying that the phrase is about those who only understands the decimal system, and thus relies on numbers in groups of 10.

The binary system is one that relies on numbers that are known to be  in groups of 2.

Therefore, If the speaker of the above phrase is one who is able to understand binary, that person  would  be able to say that that the phrase  is correctly written as  "there are 2 types of people that understand binary".

Learn more about binary from

brainly.com/question/21475482

#SPJ1

8 0
2 years ago
which of the following are advantages of a wide area network, as opposed to a local area network? select two options
AnnZ [28]

Answer:

Advantages of Wide Area Network as opposed to the Local Area Network:

Because of wide area network (WANs) connections are available from house to house, city to city, country to country. For ex: Internet.

WAN is connecting the devices with various wireless technologies such as: cell phone towers or satellites. All these are much harder to setup with LANs.

Local Area Network (LANs) connections can only operate in a local area, not bigger than a house or a floor in a office building and also you cannot buy a ethernet cable that can reach throughout entire building and Wi-Fi connection rapidly disconnected as you get further then few meters away.

3 0
3 years ago
You have selected the System Board Configuration option of the HP System Board Configuration Tool, but you receive a message tha
strojnjashka [21]

Answer:

Exit the tool and obtain the system's serial number and UUID from HP Computer Setup utility.

8 0
3 years ago
Which shortcut key in Microsoft Word 2016 will launch Spell Checker?
Pie

Alt + F7 will launch spell checker

4 0
3 years ago
Read 2 more answers
Other questions:
  • kara, darrell and jose all enjoy watching comedies online. kara and jose also enjoy watching dramas. using content-based filteri
    12·1 answer
  • What is the curriculum of digital literacy
    6·1 answer
  • K
    15·2 answers
  • 1. A formula =A1+B2 is in cell D8. If you copy that formula to cell D9, what is the new formula in cell D9?
    7·1 answer
  • Ted is asked to create a page of family photos for his family reunion Web site. He will have about 20 pictures to post, with a c
    5·1 answer
  • The SmoothWall open source firewall solution uses colors to differentiate networks. Which color indicates the private, trusted s
    9·1 answer
  • Question #17<br> Describe the two methods to open the "Conditional format rules" pane.
    13·1 answer
  • What should you do in order to have access to the header and footer tools? Open the View tab. Open the Page Setup dialog box. Op
    6·1 answer
  • Libby’s keyboard is not working properly, but she wants to select options and commands from the screen itself. Which peripheral
    14·1 answer
  • 1. State three types of web protocols​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!