Question

| Assume ori= Java Programming*/| String ori, rev = . System.out.println(Enter the string to be reversed); Scanner in =
what the output?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

the output is gnimmargorP avaJ

The code reverses a string in the for loop by concatenating starting from the last character upto first character. It finally prints the reverse string . in this case assuming ori = "Java Programming", the output on screen is gnimmargorP avaJ

Add a comment
Know the answer?
Add Answer to:
what the output? | Assume ori=" Java Programming"*/| String ori, rev = ". System.out.println("Enter the string...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA HELP: Directions Write a program that will create an array of random numbers and output...

    JAVA HELP: Directions Write a program that will create an array of random numbers and output the values. Then output the values in the array backwards. Here is my code, I am having a problem with the second method. import java.util.Scanner; import java.util.Random; public class ArrayBackwards { public static void main(String[] args) { genrate(); print(); } public static void generate() { Scanner scanner = new Scanner(System.in);    System.out.println("Seed:"); int seed = scanner.nextInt();    System.out.println("Length"); int length = scanner.nextInt(); Random random...

  • java programming how would i modify the code below to add a GUI (with a main menu with graphics and buttons, etc...) and include an option to print a list of all students added in a grid format and sh...

    java programming how would i modify the code below to add a GUI (with a main menu with graphics and buttons, etc...) and include an option to print a list of all students added in a grid format and short by name, course, instructor, and location. ///main public static void main(String[] args) { Scanner in = new Scanner(System.in); ArrayList<Student>students = new ArrayList<>(); int choice; while(true) { displayMenu(); choice = in.nextInt(); switch(choice) { case 1: in.nextLine(); System.out.println("Enter Student Name"); String name...

  • In this same program I need to create a new method called “int findItem(String[] shoppingList, String...

    In this same program I need to create a new method called “int findItem(String[] shoppingList, String item)” that takes an array of strings that is a shopping list and a string for an item name and searches through the “shoppingList” array for find if the “item” exists. If it does exist print a confirmation and return the item index. If the item does not exist in the array print a failure message and return -1. import java.util.Scanner; public class ShoppingList...

  • Java programming: The following java code is supposed to solve a linear equation of the form...

    Java programming: The following java code is supposed to solve a linear equation of the form aX+b = 0 where a and b are real numbers. However, there are some errors, nd and x them using a combination of exceptions and control statements. Hint. What could go wrong in the execution of this program? /*********************************************/ // here is the code I have: import java.util.*; public class Solver{ public static void main(String[] args){ System.out.println("Let us solve an equation of the form...

  • (Process a string) Write a program that prompts the user to enter a string and displays...

    (Process a string) Write a program that prompts the user to enter a string and displays its length and its first character. java StringLength Enter a string:Does quantum determinacy have anything to with whether human cognition is deterministic? The string is of length 88 and the first character is D import java.util.Scanner; class StringLength{    public static void main (String args[]){        Scanner input = new Scanner(System.in);        System.out.println("Enter a string:");        String ans = input.nextLine();        System.out.println("The string...

  • 1. What is the output of each of the following code segments if the inputs are...

    1. What is the output of each of the following code segments if the inputs are as follows: 5 0 15 -5 2 Scanner input = new Scanner(System.in); int sum = 0; for(int i = 0; i < 5; i++){ System.out.print( “Enter a number”); int number = input.nextInt(); if(number <= 0) break; sum += number; } System.out.println(sum); Second Segment: Scanner input = new Scanner(System.in); int sum = 0; for(int i = 0; i < 5; i++){ System.out.print( “Enter a number”);...

  • what is output public static void main(String args) Scanner keyboard new Scanner(System.in); int u 14; int...

    what is output public static void main(String args) Scanner keyboard new Scanner(System.in); int u 14; int w 0; int x; int y 5; float z = 6.1 System.out.print("Enter y: "); x keyboard.nextint); System.out.println('y'); System.out.println(x); System.out.println(w*3); x- x+(int)z; System.out.println(x); 0 System.out.println(u); System.out.,println(u); System.out.println"x In" + y); System.out.print(y + z); ) liclosing main method 1 liclosing class header

  • public static void main(String[] args) { int option=0;    while(option<8){ Scanner input=new Scanner(System.in); System.out.println("Welcome! Please enter...

    public static void main(String[] args) { int option=0;    while(option<8){ Scanner input=new Scanner(System.in); System.out.println("Welcome! Please enter your name"); String name=input.next(); Person user= new Person(name); System.out.println("Your id: "+user.getID()); System.out.println("Login successful"); System.out.println("------------------------------"); while(option!=7){ System.out.println("1.Create and host a new meeting"); System.out.println("2.Cancel a meeting"); System.out.println("3.Attend an existing meeting"); System.out.println("4.Leave a meeting"); System.out.println("5.Display my meetings"); System.out.println("6.Display meetings organized by me"); System.out.println("7.Logout"); System.out.println("8.Exit the app");    option=input.nextInt(); switch(option){ case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; case 6: break;...

  • composed the following java code to read a string from a text file but receiving compiling...

    composed the following java code to read a string from a text file but receiving compiling errors. The text file is MyNumData.txt. Included the original java script that generated the output file. Shown also in the required output results after running the java program. I can't seem to search for the string and output the results. Any assistance will be greatly appreciated. import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayList; public class Main {   public static void main(String[] args) {     System.out.print("Enter the...

  • Explain this java code, please. import java.util.Scanner; public class Program11 { public static void main(String[] args)...

    Explain this java code, please. import java.util.Scanner; public class Program11 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); final int maxSize = 128; String[] titles = new String[maxSize]; int[] lengths = new int[maxSize]; int numDVDs = 0; String op; op = menu(stdIn); System.out.println(); while (!op.equalsIgnoreCase("q")) { if (op.equalsIgnoreCase("a")) { if (numDVDs < maxSize) numDVDs = addDVD(titles, lengths, numDVDs, stdIn); } else if (op.equalsIgnoreCase("t")) searchByTitle(titles, lengths, numDVDs, stdIn);    else if (op.equalsIgnoreCase("l")) searchByLength(titles, lengths, numDVDs, stdIn); System.out.println('\n');...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT