- import java.io.*;
import java.lang.String.*;
import java.lang.*;
//javac string_toString.java
class string_toString{
public static void main(String arguments[])throws IOException
{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
//needs throws IOException
System.out.print("Type some thing : ");
String str =br.readLine();
System.out.println("--c_space = words[i].toCharArray() displays
words;--");
String[] words = str.split (" ");
int m1 = words.length;
int m4 = str.indexOf("");
System.out.println ("No of words are : " +m1);
char[] c_space = new char[m1];
for (int i =0; i <= m1-1; i++)
{
c_space = words[i].toCharArray();
System.out.print("char[] c_space is: ");
System.out.println(c_space);
System.out.println ("\twords[i] in round: " + i + " " + words[i]);
System.out.println ("\tc_space.length :" + c_space.length);
System.out.println("\tAddress of c_space.toString() : "+
c_space.toString() );
}//end for loop
}
}
/*
String: substring(int beginIndex, int endIndex)
String : static String valueOf(char[] data)
*/
|