我们知道线程能通过继承Thread和实现Runnable接口来实现,但是,他们都有一个弊端,就是run之后不能有返回值,当然我们可以通过向线程中传入变量的方式解决,但是貌似又不总是那么可靠,还好,java给了我们另外的接口Callable和Future.
我们先来看看他们的结构:
public interface Callable{
V call() throws Except...
分类:
编程语言 时间:
2015-04-09 11:59:52
阅读次数:
135
定义:提供一种方法顺序访问一个聚合对象中的各个元素,而又不暴露其内部的表示。UML类图: 1 interface Iterator { 2 public Object next(); 3 public boolean hasNext(); 4 } 5 class ConcreteIt...
分类:
其他好文 时间:
2015-04-09 10:31:09
阅读次数:
144
#define singleton_interface(className) \+ (className *)shared##className;// @implementation#define singleton_implementation(className) \static classNa...
分类:
移动开发 时间:
2015-04-09 00:47:47
阅读次数:
140
当发布一个服务端之后,客户端可以通过服务端的元数据,用VS2010添加服务引用的方式生成对应的代码。并且可以选择生成相应的异步操作。WCF实现代码,Add操作延时5秒后再返回结果。[ServiceContract] public interface ICalculator { ...
分类:
其他好文 时间:
2015-04-09 00:39:16
阅读次数:
148
//快速添加一个视图控制器#import @interface UITabBarController (ZJTabBarExtension)//快速添加一个视图控制器-(UIViewController*)andViewController:(Class)cls title:(NSString*)t...
分类:
其他好文 时间:
2015-04-08 22:46:21
阅读次数:
142
#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; self.view.bac...
分类:
其他好文 时间:
2015-04-08 19:50:32
阅读次数:
96
继承简化了对象,类的创建,增加了代码的可重性,但php只支持单继承,如果要实现多重继承,就要使用多个接口。
接口通过interface关键字来声明,并且类中只能包含未实现的方法和一些成员变量,格式如下:
interface interfaceName{
function interfaceName1();
function interfaceName2();
…
}
子类是通过im...
分类:
Web程序 时间:
2015-04-08 18:13:56
阅读次数:
160
不使用xib ,纯代码开发的过程中,动态UI 需要改对象的大小位置 反复使用CGRectMake 去 setFrame 非常低效耗时,而且 牵一发动全身.以下整理出几个方法,方便动态布局 1.set 方法 重新布局#import @interface HuofarUtils : NSObject@e...
分类:
移动开发 时间:
2015-04-08 17:58:07
阅读次数:
310
unitUnit1;
interface
usesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,OleCtrls,MSCommLib_TLB,StdCtrls,ExtCtrls;
typeTForm1=class(TForm)Panel1:TPanel;Panel2:TPanel;CheckBox1:TCheckBox;MSComm:TMSComm;Memo1:TMemo;edtcomm:TEdit;La..
分类:
其他好文 时间:
2015-04-08 16:52:22
阅读次数:
199
1.xcode中的class类属性用NsObjectClass定义 IFlySpeechRecognizer=interface(NsObjectClass) ['{4450B019-005A-461B-A6BC-6E1317C01B51}'] function _mscer:PIFlyMsc...