Java Code Examples

To discuss Java SE, Java EE technologies.
博文
(2008-08-25 19:38:22)
ThecodesbelowshowyouhowtoconvertStringtoDateinJava.
Thecopyrightofthecodesbelongstowww.javaeecoding.com
importjava.text.DateFormat;
importjava.text.SimpleDateFormat;
importjava.text.ParseException;
importjava.util.Date;
publicclassStringToDateConverter
{
publicstaticvoidmain(String[]args)
{
DateFormatdateFormat1=newSimpleDateFormat("yyyy-MM-dd");...[阅读全文]
阅读 ()评论 (0)
ThecodesbelowshowyouhowtoconvertStringtoIntegerinJava.
Thecopyrightofthecodesbelongstowww.javaeecoding.com
publicclassStringToIntConverter
{
publicstaticvoidmain(Stringargs[])
{
Stringstr="598";
intint1=Integer.parseInt(str);
System.out.println("int1="+int1);
}
}[阅读全文]
阅读 ()评论 (0)