java - 在 Java 中通过定时器传递参数
问题描述
我想通过我的计时器传递一个参数。我看过这篇文章,将参数传递给定时器任务(Java),但它似乎使用了我正在使用的不同定时器。我也看过其他一些帖子,但似乎都没有。这是我的代码。
public static Timer sendObjects = new Timer();
public static TimerTask sendTask = new TimerTask() {
public void run() {
//This is where I would use the variable I pass through
};
我想将一个字符串数组传递给这个计时器任务。类似于您使用方法执行此操作的方式。我怎么能这样做,我会用什么来运行它?
解决方案
推荐阅读
- python - 使用 For 循环 Python Pandas 屏蔽邮政编码
- cloudkit - 在禁用 iCloud 驱动器的情况下运行 CloudKit 应用程序
- java - JBoss:如何修复 IncompatibleClassChangeError;无法在 jboss 7 上链接 org/apache/cxf/ws/policy/AssertionBuilderRegistry?
- javascript - 如何从 textarea ckeditor 获取价值
- powershell - CSV 导出带有值的 ExtensionAttributes
- c - 编译器如何区分 typedef 结构实现与与结构同名的类型?
- udp - 需要帮助在 TCL 中安装 UDP 包
- html - 背景图像未在 ASP.NET Core 中显示
- python - Pygame TelePorting White Square 如何修复?
- python - 熊猫:时间列的差异返回-1天