I am new to Java and really lost. Can someone help me out?
I am not sure what is wrong here.
import java.io.*;
import java.util.Scanner; //For the scanner
public class practice
{
public static void main(String[] args) throws Exception{
}
BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
String str;
{
//Create a scanner object to read input
Scanner keyboard = new Scanner(System.in);
try {
System.out.print("Enter your name:");
str=new String();
String str= new String();
str +=",This will demonstrate the reverse function.";
//Create a object of String Buffer class
StringBuffer strbuf= new StringBuffer();
strbuf.append(str);
System.out.println(strbuf);
strbuf.delete(0,str.length());
//reverse()
strbuf.reverse();
System.out.print("Reversed string : ");
System.out.println(strbuf);
strbuf.reverse();
System.out.println(strbuf);
}
catch(StringIndexOutOfBoundsException e){
System.out.println(e.getMessage());
}
}
}