0% found this document useful (0 votes)
7 views1 page

Java Program to Reverse a String

The document contains a Java program that reverses a given string input by the user. It uses a Scanner to read the string, converts it to a character array, and then prints the characters in reverse order. However, there is a syntax error in the for loop due to an unnecessary semicolon.

Uploaded by

Rushabh Shah
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Java Program to Reverse a String

The document contains a Java program that reverses a given string input by the user. It uses a Scanner to read the string, converts it to a character array, and then prints the characters in reverse order. However, there is a syntax error in the for loop due to an unnecessary semicolon.

Uploaded by

Rushabh Shah
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Rushabh shah

19bcp108

import [Link];
public class reversestring {

public static void main(String[] args) {


// TODO Auto-generated method stub
char[] array1;
int i;
Scanner scan=new Scanner([Link]);
[Link]("enter a string to reverse");
String str=[Link]();
[Link]();
array1=[Link]();
[Link]("reverse of string:");
for(i=[Link]()-1;i>=0;i--);{
[Link](array1[i]);

You might also like