易截截图软件、单文件、免安装、纯绿色、仅160KB

Java定时任务的实现

①继承TimerTask,重写run方法
package bamboo.task;
import java.util.TimerTask;
public class TimeTaskTest extends TimerTask{
 @Override
 public void run() {
  System.out.println("hi");
 }
}
②通过timer来设置某个时间来调用,或者是相隔多长时间调用
package bamboo.test;
import java.util.Date;
import java.util.Timer;
import bamboo.task.TimeTaskTest;
public class TimeTest {
 static TimeTaskTest test=new TimeTaskTest();
 
 public static void main(String [] args){
  Timer timer=new Timer();
  
  //启动和间隔的时间 1000毫秒
  
  //timer.schedule(test,0,1000);
  
  //设置什么时候执行
  //timer.schedule(test, new Date());
 }
}


相关文档:

Java 静态代理和动态代理

1. 代理模式主要有两种:静态代理和动态代理
2. 静态代理:
比如要在输出“HelloWorld”前打印一个字符串“Welcome”
A:先定义一个接口类
Java代码
package ttitfly.proxy;       
      
public interface HelloWo ......

Java正则表达式详解


如果你曾经用过Perl或任何其他内建正则表达式支持的语言,你一定知道用正则表达式处理文本和匹配模式是多么简单。如果你不熟悉这个术语,那么“正则表达式”(Regular Expression)就是一个字符构成的串,它定义了一个用来搜索匹配字符串的模式。
许多语言,包括Perl、PHP、Python、JavaScript和JScript,都支 ......

JAVA的容器 List,Map,Set

JAVA容器
  解释一:
  容器(Container)
  Spring 提供容器功能,容器可以管理对象的生命周期、对象与对象之间的依赖关系,您可以使用一个配置文件(通常是XML),在上面定义好对象的名称、如何产生(Prototype 方式或Singleton 方式)、哪个对象产生之后必须设定成为某个对象的属性等,在启动容器之后,所有 ......

Object Ordering java 排序

Object Ordering
A List l may be sorted as follows.
Collections.sort(l);
If the List consists of String elements, it will be sorted into alphabetical order. If it consists of Date elements, it will be sorted into chronological order. How does this happen? String and Date both implement the Compara ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号