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 do we call the software which programmers use to program?​
babunello [35]

Answer:

JavaScript currently stands as the most commonly-used language in the world (69.7%), followed by HTML/CSS (62.4%), SQL (56.9%), Python (41.6%) and Java (38.4%).

7 0
2 years ago
What is indentation?
horrorfan [7]

Answer:

B

Explanation:

3 0
3 years ago
Read 2 more answers
suppose one packet switches between a sending host and a receiving host. the transmission rates between the sending host and the
ICE Princess25 [194]

The total end-to-end delay to send the packet length is L/R1 + L/R2. When using store-and-forward packet switches, the end-to-end delay is calculated as d = N × L/R.

<h3>How can you determine a packet's end-to-end delay?</h3>
  • When using store-and-forward packet switches, the end-to-end delay for sending a single packet of length L across N connections, each with a transmission rate R, is d = N × L/R. (Queuing, propagation delay, and processing time are all ignored).
  • The amount of time it takes a packet to travel from source to destination across a network is known as one-way delay (OWD).
  • It is a term that is commonly used in IP network monitoring. It differs from round-trip time (RTT) in that it only measures the journey from source to destination in one direction.
  • Propagation delay is the amount of time it takes for one bit to travel from the sender to the receiver end of a link.
  • Propagation delay is defined mathematically as the distance between sender and receiver. Propagation delay ∝ 1 / transmission speed.

To learn more about One-way delay, refer to:

brainly.com/question/27217941

#SPJ4

6 0
1 year ago
Your friends know that you understand a lot about computers, both the technical details of how they operate as well as informati
erma4kov [3.2K]

Answer:

The answer is A.

Explanation:

Regarding the information given in the question, we are asked to evaluate the options given which i believe have answers as follows;

B is true. Public-domain means that there are no individuals who hold a copyright over the subject which enables people to copy and distribute, the software in this case, freely.

C is true. Shareware is a term that is used for applications which have a certain trial period for users to decide whether the application meets their needs and demands and then they have to pay the required amount to keep using the software to its full potential. Most often it is the case that if the user does not agree to a payment, the features they are allowed to use are very limited and render the software almost useless until the payment is completed.

D is true. "Copyright" is by definition is approved by the authorities and gives its creater the right to use, sell and change the creative product as they please. It works the same way for software products as well so the statement in option D is true.

A is wrong. Although they are freeware, this softwares still may have copyrights and even if they do not, they are very basic or even incomplete programs to satisfy the minimal needs of its users.

I hope this answer helps.

7 0
3 years ago
What are the nuclear codes?
inn [45]

Answer:

Nuclear codes allow the president to prove the individual is authorized to order the launch.

Explanation:

Hope this helps!

If not, I am sorry.

3 0
2 years ago
Other questions:
  • What are the two different frequencies WiFi operates on?
    9·2 answers
  • A company decides to reduce its IT labor force by hiring an external company to manage various aspects of IT administration, suc
    6·1 answer
  • Google Slides saves your work to Google Drive. PowerPoint has the option to save to OneDrive. Both of these solutions are in the
    9·1 answer
  • Angle, oblique, regular, demi, roman, heavy, extra bold, expanded, and compressed are ___________ . Select one: A. type styles B
    10·1 answer
  • Which is better analog music or digital music
    15·2 answers
  • Create a pseudocode program that asks students to enter a word. Call a function to compute the different ways in which the lette
    9·1 answer
  • Give two advantages of representing integers in pure binary.
    5·1 answer
  • QUESTION 10
    10·2 answers
  • What does input allow a computer to do
    14·1 answer
  • Where is the flash drive listed in a windows 7 save as dialog box?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!