String Tokenizer in Java…
Example : STDemo
import java.util.StringTokenizer; class STDemo { static String in ="title=java:The Complete Reference;"+"author=Schildt;"+ "Publisher=Osborne/McGraw-Hill;"+ "copyright=2002"; public static void main(String args[]) { StringTokenizer st=new StringTokenizer(in,"=;"); while(st.hasMoreTokens()) { String key=st.nextToken(); String val=st.nextToken(); System.out.println(key+"\t"+val); } } }
Vector in Java…
Example : VectorDemo
import java.util.*; import java.io.*; class VectorDemo { public static void main(String args[]) { Vector<String> list=new Vector<String> (); list.add("software"); list.add("testing"); list.add("program"); list.add("class"); list.insertElementAt("JAVA",2); list.removeElementAt(3); //list.removeAllElement(); //list.removeElement("c"); int size=list.size(); String l[]=new String[size]; list.copyInto(l); System.out.println("List of Languages"); for(int i=0;i<size;i++) { System.out.println(l[i]); } } }
Hash Table in Java…
Example : HashDemo
import java.util.*; class HashDemo { public static void main(String args[]) { String s1="hello"; String s2="Hello"; System.out.println("The hash code for"+s1+"is"+s1.hashCode()); System.out.println("The hash code for"+s2+"is"+s2.hashCode()); } }