How to Reverse a String in Java

preview_player
Показать описание
Check out our courses:

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO20 (20% Discount)

Recommend Books :

Reversing a String in Java.
in Simple Steps only for Beginners

Subscribe to the channel and learn Programming in easy way.

Рекомендации по теме
Комментарии
Автор

Fun fact: everyone raised their volume in starting of the video😄

mohamedwasim
Автор

simple and good 👍👍 but bit complicated without sound

SmartProgramming
Автор

Excellent. Intuitive commenting meant the sound was not required for me personally. Thank you!

michealmclaughlin
Автор

Thank you! Great video made it simple and easy for me to understand.

plebblanco
Автор

Great job!  Thank you for the posting.

limsoyoun
Автор

Very good and simple easy to understand. Please use voice

RajeshR-ypsy
Автор

Simple logic

//String reverse
package abc;
import java.util.*;
public class abc1 {


public static void main(String args[]){

Scanner sc=new Scanner(System.in);
System.out.println("Enter a String");
String str=sc.nextLine();
StringBuffer sb=new StringBuffer(str);
System.out.println("string rev is "+sb.reverse());

}
}

AmitAswar
Автор

why did you make :original=sc.nextLine?i mean sc is object ivoking the method nextline but why and how is ti possible to make it as an object for the string??your answer will help me

IQ
Автор

Easy method to rev a string please correct me if it is wrong

INPUT = ABCD
OUTPUT = DCBA

let's do a code

Class ReverseString {
public static void main(sttring [] args)
{
String word="ABCD";
String word2="";
for(i=word.length()-1; i>=0; i--) // here we take that length of a word is 4 so we take it as -1 now 4-1=>3, now that i>=0 is that loop continue until it satisfies the condition now,
{
word2 = word2 + word.charAT(i);
}
System.out.println(word2);
}
}
o/p:-
DCBA

That is like to be length of word 4-1=3 that means it pointed position 3, so that A will be as in position 0 like A(0), B(1), C(2)D(3) so first the condition I>=0 will be satisfy the condition by i-- so it run untill the loop satisfies like 3, 2, 1, 0 as D, C, B, A 👍👍

TT-xgqd
Автор

Hey its emergency
Input = knowledge
Output = ledgewonk

How to get this please replay any onr

girishgowda
Автор

if String in java is immutable then how can it possible to change the initial value of s2

jaydobariya
Автор

sometimes why we use
String h=""

please answer

hemanthkumar-gxjn
Автор

import java.util.*;
public class Main
{
public static void main(String[] args) {
System.out.println("Enter the string");
Scanner s=new Scanner(System.in);
String str=s.nextLine();
String rev="";
int i;
int len=str.length();
for( i=len-1;i>=0;i--);
{
rev=rev+str.charAt(i);
}
}
}
sir is there any error in my program its not executing sir

darkwarrior
Автор

Hello sir I want ask one thing like if I have some string I want to retract 5 and 6 place cahracter or digit from that how is it possible

Consider
String st="14231332343344"
And I want to extract 1 st 3 digit diffrent and 2 3 digit different
A=142
B=313

Could you pls help

sushiltiwari
Автор

what packages should write for this program

rakeshbashettifilmwriter
Автор

please upload a video for reversing array without using scanner case plssss help me

musicallycreation
Автор

Why wont the first work?? Also how are you using the scanner, i see you never imported it

memelordcameron
Автор

count the number of occurrences of a character in a string using java .sir can you explain this program in simple way.

amitdubey
Автор

you should put your laptop on power!! gives better performance..

abhishekmanral
Автор

String reverse without logic please reply sir

haneeshan