摘要:
import java.util.StringTokenizer;public class StringTokenizerTest { public static void main(String[] args) { String str="数学::英语::语文::化学"; StringTokenizer st=new StringTokenizer(str,"::"); System.out.println(st.countTokens()); while(st.hasMoreTokens()) ... 阅读全文
摘要:
1 public class StringBufferTest { 2 public static void main(String[] args) { 3 StringBuffer sb=new StringBuffer(); 4 sb.append("aaa"); 5 sb.append("bbb"); 6 sb.append(123); 7 sb.append(false); 8 sb.insert(3, "tt"); 9 sb.insert(3,true);10 ... 阅读全文
摘要:
public class TypeConvert { public static void main(String[] args) { fromInt(); fromFloat(); fromDouble(); fromChar(); toOther(); } public static void fromInt() { Integer intvar=1; String Strint; Strint=String.valueOf(int... 阅读全文
摘要:
1 public class StringTest { 2 3 public static void main(String[] args) 4 { 5 String a=new String("sSassasss"); 6 7 System.out.println(a.substring(1)); 8 9 System.out.println(a.substring(2,4));10 11 String[] array=a.split(",", 3);12 ... 阅读全文
摘要:
import java.util.Date;public class datetest { public static void main(String[] args) { Date _date=new Date(); long _time=_date.getTime(); System.out.println(_time); }} 阅读全文
摘要:
1 import java.util.Hashtable; 2 public class HashTable { 3 public static void main (String[] args) 4 { 5 Hashtable ht=new Hashtable(); 6 ht.put("xiao wang", 30); 7 ht.put("zhang san", "aaa"); 8 ht.put("he hai", true); 9 10 System.out.println(ht.size());11 ht.r 阅读全文
摘要:
1 import java.util.Vector; 2 3 public class VectorTesting { 4 public static void main(String[] args) { 5 Vector _vector=new Vector(); 6 Integer intObj=new Integer(1); 7 _vector.addElement(intObj); 8 String strObj="1"; 9 _vector.addElement(strObj);10 ... 阅读全文