
java
studyjavalm1017
这个作者很懒,什么都没留下…
展开
-
java向mysql中插入图片,类型为blob
try{ Class.forName("com.mysql.jdbc.Driver");//驱动的名称 Connection c=DriverManager.getConnection("jdbc:mysql://localhost/数据库名?user=用户名&password=密码");//访问的数据库的帐号密码Statement s=c.createStatement();...原创 2008-09-02 08:42:39 · 273 阅读 · 0 评论 -
字符串转日期类型
方法一:String s = "08年09月02日"; SimpleDateFormat sd = new SimpleDateFormat("yy年MM月dd日"); try{ Date d =sd.parse(s); System.out.println(d); }catch(ParseException e){ e.printStackTrace()...原创 2008-09-02 08:45:57 · 130 阅读 · 0 评论 -
如何截取含有中文的字符串
package substr;import java.io.UnsupportedEncodingException;/** * 判断是否是一个中文汉字 * * @param c * 字符 * @return true表示是中文汉字,false表示是英文字母 * @throws UnsupportedEncodingExc...原创 2008-09-02 08:47:08 · 326 阅读 · 0 评论 -
整数转换成Date
下面是把整数转换成Date import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Text { public static void main(String[] args){ SimpleDateFormat dd=new SimpleDateF...原创 2008-09-02 09:07:33 · 1853 阅读 · 0 评论 -
单例模式的实现
在实际开发中,有些情况下未来避免镀铬实例对象,会用到设计模式的单列模式通常情况实例对象都是通过public的构造函数实现,这边为了避免多个实例对象,所以用私有的构造函数,防止外部访问,如下代码就是如此实现:GoF的解决方案 下面让我们看看最流行的解决方案吧,当然也是我们在项目中用到的最广泛的GoF的那本“设计模式圣经”里面所描述的: 1. public class PrintSpo...原创 2008-10-08 14:40:14 · 103 阅读 · 0 评论 -
继承类之间的执行顺序
:父类: package test; public class FatherClass { public FatherClass() { System.out.println( "FatherClass Create "); } } 子类: package test; import test.FatherClass; public ...2008-10-09 13:58:51 · 421 阅读 · 0 评论