关于Runnable接口的JDK文档翻译

The Runnable interface should be implemented by any
class whose instances are intended to be executed by a thread.

Runnable 接口应该由那些打算通过某一线程执行其实例的类来实现。其中whose 是定语从句,whose 是定语从句中一个常用的关系代词, 它是关系代词who的所有格,在从句中作定语,也就是说当先行词与从句中某个名词有所属关系,表达“……的”意思时,用关系代词whose 引导定语从句,它既可以指代人,也可以指代物,既可引导限制性定语从句,也可以引导非限制性定语从句。

(注:定语从句修饰一个名词或代词,被修饰的名词,词组或代词即先行词)

 

 

The class must define a method of no arguments called run.

类必须定义一个称为 run 的无参数方法。 call为命名,取名的意思

This interface is designed to provide a common protocol for objects that
wish to execute code while they are active.

设计该接口的目的是为希望在活动时执行代码的对象提供一个公共协议

这里的that是定语从句。

For example,
Runnable is implemented by class Thread.

例如,Thread 类实现了 Runnable
Being active simply means that a thread has been started and has not
yet been stopped.

激活的意思是说某个线程已启动并且尚未停止。

In addition, Runnable provides the means for a class to be
active while not subclassing Thread.

另外,Runnable 为非 Thread 子类的类提供了一种激活方式

A class that implements
Runnable can run without subclassing Thread
by instantiating a Thread instance and passing itself in
as the target. 

通过实例化某个 Thread 实例并将自身作为运行目标,就可以运行实现 Runnable 的类而无需创建 Thread 的子类。

In most cases, the Runnable interface should
be used if you are only planning to override the run()
method and no other Thread methods.
This is important because classes should not be subclassed
unless the programmer intends on modifying or enhancing the fundamental
behavior of the class.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值