Answer to Question #3490 in Java | JSP | JSF for Y mukundareddy
Write a program to find the character at 6th place in the following string?
String str=”Hello world”
1
2011-08-16T11:54:15-0400
import java.io.*;
public class Character6Finder
{
public static void main(String[] args) throws IOException
{
BufferedReader bReader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the string: ");
String inputStr = bReader.readLine();
if (inputStr.length() >= 6)
System.out.println("The 6th of this string = '" + inputStr.charAt(5) + "'");
else
System.out.println("The string contains less than 6 characters");
}
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
JavaJSPJSF
Comments
Leave a comment