Problem 2: CharAt and length

Similar the previous problem, create a program that will allow the user to enter a string (word or phrase) that will also show the second character and the length based on the string entered by the user.

import java.io.*;
class s30
{
public static void main (String args[]) throws IOException
{
DataInputStream k=new DataInputStream (System.in);

String a;

System.out.println("Enter String: ");
a=k.readLine();
char s = a.charAt(1);
System.out.println(s);
System.out.println(a.length());
}
}

No comments:

Post a Comment

Extended Search

Custom Search
Hello World