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
Ierofanga [76]
4 years ago
5

Write a Java program that generates a new string by concatenating the reversed substrings of even indexes and odd indexes separa

tely from a given string.

Computers and Technology
1 answer:
salantis [7]4 years ago
8 0

Answer:

/ReversedEvenOddString.java

import java.util.Scanner;

public class ReversedEvenOddString {

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       String s = sc.nextLine();

       String evens = "";

       String odds = "";

       for(int i = s.length()-1;i>=0;i--){

           if(i%2==1){

               odds += s.charAt(i);

           }

           else{

               evens += s.charAt(i);

           }

       }

       String res;

       if(s.length()%2==1){

           res = evens+odds;

       }

       else{

           res = odds+evens;

       }

       System.out.println(res);

   }

}

You might be interested in
In the water cycle,lake water will do which of the following first
Agata [3.3K]

What are the following?

5 0
3 years ago
The ArrayList class ____ method returns the current ArrayList size.
timurjin [86]

Answer:

b. size

Explanation:

We can use the size() method of java.util.ArrayList to determine the size of an  ArrayList in Java. The size() method of the ArrayList class returns an integer which is equal to the number of elements present in the ArrayList.

Below is an example code to illustrate the use of the size() method of the ArrayList:-

     ArrayList<Integer> aList = new ArrayList<Integer>(5);

      aList.add(25);

     aList.add(2);

     aList.add(5);

     aList.add(22);

     System.out.println("Size of the array list: " + aList.size());

This will print the size of the array list as 4 since we've added four numbers into the array list.

3 0
4 years ago
What is the average gradient of the slope along the straight line CD
Anvisha [2.4K]

Answer:

is there a graph to go with this?

Explanation:

7 0
3 years ago
A measure of the twisting or rotational force that an engine can produce is called
Snowcat [4.5K]
The correct answer is torque.

Torque
A twisting force that tends to cause rotation, commonly used term among mechanics and engineers.
7 0
3 years ago
Using technologies increase the time needed to complete a task is beneficial
nata0808 [166]

Answer:

True

Explanation:

The advent of technology has given human to achieve a whole lot more in a rather short period of time when compared to the period where the major tool of engagement and task is Manual. With technology, aside from having the ability to complete task faster, we can achieve more accurate result and a lot attractive output. All these in very little time. Technology has helped industries grow multiple times faster thus increasing input, yield and productivity. The tedious nature of having to work manually has also been expunged with repetitive task now being programmed and automated.

3 0
3 years ago
Other questions:
  • Tanya is entering the amount of money she has earned from babysitting onto an Excel spreadsheet, but the AutoComplete feature is
    9·2 answers
  • The default ____ for a hyperlink is the folder location and the name of the file to which you will link.
    6·1 answer
  • Write a while loop that prints that number doubled without reaching 100. Follow each number with a space. After the loop, print
    12·1 answer
  • How much does it cost to go to csun school
    15·1 answer
  • which statement is true? O A Future games will be more context oriented. OB. Future games will be more product driven. Future ga
    13·2 answers
  • List of rules for expert systems​
    6·1 answer
  • When first designing an app, all of the folldwing are important EXCEPT
    13·1 answer
  • The cpu stores the results of computations in ________.
    8·2 answers
  • Why not to use settimeout in angular.
    13·1 answer
  • in makecode arcade, which part of the interface can be used to answer questions about how a block functions?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!