How to Reverse a String in java in Hindi (best ways with examples)

Last Updated on

Kaise ho dosto! Agar aap How to Reverse a String in Java ya phir simple
Reverse String in Java ke baare mein jaana na chahte hain to aap sahi jagah par aye ho kyunki dosto is article mein main aapko How to Reverse a String in Java ke baare mein batane wala hoon.

How to Reverse a String in java
How to Reverse a String in java

How to Reverse a String in java

How to reverse a string in Java ye ek bohat hi badiya cheez hai janne ke liye ke hum string ko reverse kaise karte hain Java mein. How to reverse a string in Java yeh ek aisa question hai jo ki bahut sare interview mein bhi pucha jata hai.

Isi beech mein main aapko Hindi mein batane wala hoon ke hum reverse a string in Java kaise karte hain aur main inki examples bhi dunga aur un methods ke bare mein bhi btaunga jin method se hum reverse string in Java kar sakte hain.

Chaliye dosto How to reverse a string in Java ke baare mein puri jankari jaan lete hain.

Reverse a string in Java | Reverse string in Java

Mene ye sare methods one by one karke diye huye hain

1) Reverse a string in Java by using StringBuffer or StringBuilder

Jaisa ki hum sab jante hain ki stringBuffer and StringBuilder dono hi string ko reverse karne ke kaam aate hain aur agar hum string ko reverse karna chahte hain Java main to stringbuffer ya phir stringbuilder bohat hi helpful rahenge.

Iski examples niche di gayi hai program ke sath:
String input = “exotic”;
StringBuilder sb = new StringBuilder(input);
String result = sb.reverse().toString();
System.out.println(result); //prints ‘citoxe’

2) Reverse a string in Java by using external class

Agar aap string ko reverse karte hain external class ki method se to ap string ko easily reverse karoge Java mein. Iski example bhi niche di gayi hai program ke sath:

 import java.util.Scanner;
  public class ReverseString
 {
     public static void main(String[] args)
     {
         System.out.println("Exotic");    
Scanner read = new Scanner(System.in);
    String str = read.nextLine();
    String reverse = "";

    for(int i = str.length() - 1; i >= 0; i--)
    {
        reverse = reverse + str.charAt(i);
    }

    System.out.println("citoxE");
    System.out.println(reverse);
}
}

3) Reverse a string in Java by Reverse Iteration

Reverse Itration se bhi hum string ko Reverse kar sakte hain Java mein.
Iski example bhi niche di gayi hai aur program ke sath:

public class TestStringFormatter {
public static void main(String[] args) {
System.out.println(StringFormatter.reverseString(“Exotic”));
}
}
Output:
citoxE

4) Reverse a string in Java by Array

Agar aap string to reverse karna chahte hain Java mein to array aapke liye Best sabit ho sakta hai kyunki with the help of array hum string ko reverse kar sakte ho Jawa main easily

Also Read: General Knowledge Question and Answers in Hindi

Iski example bhi niche di gayi hai aur program ke sath:

class ReverseofaString
{
public static void main(String[ ] arg)
{
String str;
Scanner scan=new Scanner(System.in);
System.out.print(“Enter a string : “);
str=scan.nextLine();
char[] ch=str.toCharArray();
System.out.println(“Reverse of a String is : Exotic”);
int j=ch.length;
for(int i=j;i>0;i–)
{
System.out.print(ch[i-1]);
}
}
}
Output:
citoxE

How to reverse a string in java in hindi video

Posts jo apko achi lgengi

HOW TO REMOVE DARK CIRCLES IN HINDI
10 Green tea benefits in Hindi | Green tea ke fayde(Puri Jankari)
15 Best Business Ideas in Hindi with low investment(Puri Jankari)
How to Improve Handwriting in Hindi (Powerful Tips)
35 Best Motivational quotes in Hindi for Students with images
15 benefits of yoga in Hindi | Importance of yoga in Hindi

Final Words

Toh Dosto aaj k is article mein Maine aapko bataya How to Reverse a String in java aur Reverse a String in java.

Main Umeed Karta Hun Ki aapko How to Reverse a String in java aur Reverse a String in java  ke bare mein puri jankari bahut hi acchi lagi Hogi.

Agar Apke Pas koi bhi doubt hai ya phir koi bhi sawal hai jo aap hamse puchne chahte ho toh niche comment kark aap apna wo doubt ya phir question puch skte Hain.
Thanks.

admin

Hi friends! Mera naam Exotic Irfan hai aur mein apka is site pe sawagat karta hun. Dosto mein is site mein har tarah ki knowledge share karta hun chahe wo study ke related ho, technology ke related ho ya phir other Internet ki jankari. Dosto mujhe dusro ki madad karna acha lagta hai.

Leave a Reply

Your email address will not be published. Required fields are marked *