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
Cloud-based services can open doors to leveraging Artificial Intelligence (AI) without dramatically increasing risk. Which clien
vladimir1956 [14]

Answer:

Explanation:

The clients that would be best suited for this opportunity would be small business or business' that do not have the hardware/space resources necessary to create the computing power that they need. Instead, they can simply pay for these cloud-based services which provide all of the necessary computing/hardware power and resources necessary so that the company can easily fulfill all of their tasks without any problems. Bigger companies can easily pay for and implement their own hardware to solve their problems which may benefit them even more in the long-term.

7 0
3 years ago
What is the correct order of the phases of the software development process?
Tom [10]

Answer: Planning, Requirements, Design, Build, Document, Test, Deploy, Maintain.

Explanation:

Software Development Life Cycle is the application of standard business practices to building software applications. It's typically divided into six to eight steps / provided above...

6 0
3 years ago
Differences between analog computer and hybrid computer​
aleksandrvk [35]

Answer:

Analog computers only work with continuous numerical data in analog quantities, digital computers can process both non-numerical and numerical data and a hybrid computer is a combination of both analog and digital. A hybrid computer has the accuracy of a digital computer paired with speed of an analog one.

5 0
3 years ago
Read 2 more answers
Which of these is an application? Microsoft Windows Linux Microsoft Word Apple ios​
STALIN [3.7K]

Answer:

I think it's Microsoft windows

8 0
4 years ago
Read 2 more answers
How artifical intelligence will have more effect on our day to day life ? ​
astraxan [27]

Answer:

Artificial intelligence can dramatically improve the efficiencies of our workplaces and can augment the work humans can do. When AI takes over repetitive or dangerous tasks, it frees up the human workforce to do work they are better equipped for—tasks that involve creativity and empathy among others.

3 0
2 years ago
Other questions:
  • The content of each content page that uses a master page is stored in the ________________ of the master page.
    6·1 answer
  • Which tool is used to create an interactive web application?
    15·1 answer
  • What happens when a filter is applied to a database?
    13·1 answer
  • The _________ indicates the number of elements, or values, an array can hold
    14·1 answer
  • In Word, a red wavy underline indicates a/an
    15·1 answer
  • Determine if x(t) is periodic and determine the fundamental period.
    15·1 answer
  • Betty removed a web page from her website. Some users were browsing on her website. One of them clicked on a particular link and
    10·1 answer
  • For this question you must write a java class called Rectangle and a client class called RectangleClient. The partial Rectangle
    14·1 answer
  • How can I find all the answers for the NWEA MAP Math, English, Reading, and Science tests? Please help!!!!! I found some answers
    6·1 answer
  • Write an application that allows a user to enter a filename and an integer representing a file position. Assume that the file is
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!