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
Afina-wow [57]
3 years ago
7

Write a Java method that will take a string and reverse it. Can you come up with a method that is faster than regular reversing

of the for loop? [10 points] Example #1: Input: ‘Hello World’ Output: ‘dlroW olleH’
Computers and Technology
1 answer:
rewona [7]3 years ago
3 0

Answer:

The program to this question as follows:

Program:

import java.util.*; //import package

class Main //defining class  Main

{

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

{

String input_string, input; //defining string variables

Scanner obz=new Scanner(System.in); //creating scanner class object

System.out.println("Input the string value:   "); //print message

input_string=obz.nextLine(); //input value by user

input=new StringBuffer(input_string).reverse().toString(); //creating instance variable with using reverse method

System.out.print(input);//print value    

}

}

Output:

Input the string value:  

Hello World

dlroW olleH

Explanation:

In the above program code, a class Main is defined, inside this class-main function is declared, inside this function two string variable "input_string and input" are defined, in which the "input_string" variable is used to take input from the user side.

  • The input variable used as an instance variable, that uses StringBuffer, reverse, and toString method.
  • The StringBuffer accepts the "input_string" variable as parameter and toString, reverse method is used to convert all value into a string and reverse method convert value in reverse order. In the last, the print function is used that print input variable value.
You might be interested in
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
Please help with coding assignment.
Inessa05 [86]

Answer:

import java.util.Random;

class Main {

   

   public int stopAtFive (int j) {

      Random rand = new Random();

      int number = 0;

      for(int i=0; i<j; i++) {

          number = rand.nextInt(9)+1;

          System.out.println(number);

          if (number == 5) {

              System.out.println();

              break;

          }

      }

      return number;

   }

   

   public static void main(String args[]) {

       Main main = new Main();

       main.stopAtFive(20);

       main.stopAtFive(20);

   }

}

Explanation:

Your requirements do not say what has to be displayed or returned from the method, but you can use this as a starting point.

4 0
3 years ago
From your first impressions, write down what first comes to mind as to what is good or bad about the way the website/system work
suter [353]

Answer: I will consider the factors below

Usability: A measure of a user’s ability to arrive on a site, use it easily, and complete the desired task. Remember, we’re designing websites, where there is flow, rather than focusing on page design and assuming everything will flow later.

Explanation:

1.) It should be easy for the user to become familiar with and competent in using the user interface on the first contact with the website. If we take a travel agent’s website that a designer has made well, the user should be able to move through the sequence of actions to book a ticket quickly.

2.) It should be easy for users to achieve their objective through using the website. If a user has the goal of booking a flight, a good design will guide him/her through the easiest process to purchase that ticket.

3.) It should be easy to recall the user interface and how to use it on subsequent visits. So, a good design on the travel agent’s site means the user should learn from the first time and book a second ticket just as easily.

4.) We also consider user's experience

5.) The hosting server of the website

6.) Usability: A measure of a user’s ability to arrive on a site, use it easily, and complete the desired task. Remember, we’re designing websites, where there is flow, rather than focusing on page design and assuming everything will flow later.

4 0
4 years ago
Shortly after its introduction, the unix software was rewritten in the popular c programming language.?
nirvana33 [79]
Of course it was rewritten in the popular C++ Programming Language.

a. True
5 0
3 years ago
* what is an electronic mail ?
Vikki [24]

Answer:

Electronic mail is a method of exchanging messages between people using electronic devices. Email entered limited use in the 1960s, but users could only send to users of the same computer, and some early email systems required the author and the recipient to both be online simultaneously, similar to instant messaging.

6 0
3 years ago
Other questions:
  • What safety precaution should you take while filling the fuel tank of a gasoline-powered boat?
    8·1 answer
  • 1. Rice paste changes from white to blue black colour when a few drops of iodine solution are added to it. It shows the presence
    8·1 answer
  • A field that will always have a unique value is
    15·2 answers
  • Write a command that will start and run the gedit command in the background.
    8·1 answer
  • Write a C++ function, lastLargestIndex that takes as parameters an int array and its size and returns the index of the last occu
    10·1 answer
  • How many water bottles must be collected to win?
    8·2 answers
  • To get started with stock trading and to learn, many people start with this method to learn the ropes and practice with fake mon
    13·1 answer
  • When you tap or click the ____ button for a selected graphic, Word provides options for changing how a graphic is positioned wit
    5·1 answer
  • You're the administrator for a large bottling company. At the end of each month, you routinely view all logs and look for discre
    8·1 answer
  • 5 disadvantage of assembly<br> level language​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!