//格式化日期为指定的格式 java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss"); format.format(rs.getTimestamp("birth")) //将字串符转换成日期类型 //在数据库中将字符串转成日期存入数据库 //发送SQL语句,执行存储过程 //更新时使用数据库的系统时间(sysdate) //IO的几种常用通信方法---------------采用对象方式进行传输数据-------------------------
java.io.ObjectOutputStream out = new java.io.ObjectOutputStream( -------------------------------------------------------------- this.button.addActionListener( ---------------------------------------- 另一种添加事件的方法 //在剪切时候,它在一个内部类 ----------------------------------------- R1 r = new R1(); new Thread(new W(socket)).start(); class R1 implements Runnable{ class Thread1 extends Thread{ 命名线程://Thread t2 = new Thread(new Thread3(10),"线程名")
} //设置窗口关闭时自动退出 ------------------------------------------在lesson中有一个鼠标事件还没有看通,有点复杂(day16) //给按钮添加事件的一种方法
LotteryFunction 为功能类 将this作为工功能类构造的参数可很方便的在窗体显示计算结果 ------------------------------------------------------------------------------ 如面板上有多个控件时,可用以下方法将其加入面板中 ------------------------------------------------------------ static int t; -------------------------- 如何给文件进行锁定
------------------------------ java.io.FileInputStream in = new java.io.FileInputStream("TestNIO.java"); ---------------文件传输
byte[] b =new byte[32]; 2----------- java.io.FileReader f =new java.io.FileReader("c://t.txt"); 3------------------ 4----------------------- 5------------------------ 6-------------------------------向文件写入数字 7---------------------------------未看懂的代码???????????? //压缩解压文件的代码--还未看 public static void ZipFile()throws Exception{ ---------- ------------------从控制台向文件输入数据 java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); ---------------------添加多的一个“/”表示转义符 实现文件类型的过滤方法-------1 String[] list = f2.list(); ----------------------------2( 多个过滤方式) //String[] list = f2.list(); --------------------------------------------------删除有文件的目录实用代码 public static void delDir(java.io.File dir){ System.out.println ("文件大小 "+s/1024+" kB"+" = "+(float)s/1024/1024+"M");
--------------------------------------------------------几种集合类的使用 java.util.ArraryList list=new java.util.ArraryList(); java.util.HashSet set = new java.util.HashSet(); java.util.Properties p = new java.util.Properties(); try{ } static char[] getText(String s){ int[][] in= new int[5][]; 3>>1 正数移位 0011---》 0001 为1(正数移位在前面加0) -----------描述注释文档----------------javadoc -d 文件绝对路径 -author -version private/public/protected /** /** /** /** |
比较有用的代码
最新推荐文章于 2021-09-16 15:17:51 发布
有用代码录
2006-07-14 00:38