Structure of the Problem Requirements
In this Problem we learn how to Reverse a String in Java with using Java builtin Function. User will Enter a String and that string pass to the parameter of another string which has function to reverse the user story. At the end of the program the program will display string before reversing and after reversing.
Source Code
package com.ancodingpoint.ww.w;
import java.util.Scanner;
public class String_Function {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
String sentence = "";
System.out.println(" Enter your Story Here .... ! ");
sentence = input.nextLine();
String reverse = new StringBuffer(sentence).reverse().toString();
System.out.println(" \n Your Story Before Reverse \n " + sentence);
System.out.println(" \n Your Story After Reversing the String \n " + reverse);
}
}
Output of the Program
Reverse a String |
Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.
0 comments:
Post a Comment