我们知道线程能通过继承Thread和实现Runnable接口来实现,但是,他们都有一个弊端,就是run之后不能有返回值,当然我们可以通过向线程中传入变量的方式解决,但是貌似又不总是那么可靠,还好,java给了我们另外的接口Callable和Future.
我们先来看看他们的结构:
public interface Callable{
V call() throws Except...
分类:
编程语言 时间:
2015-04-09 11:59:52
阅读次数:
135
Camera GPS标志设置的应用LocationManager/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in com...
分类:
其他好文 时间:
2015-04-08 13:18:04
阅读次数:
245
http://www.2cto.com/kf/201301/184121.htmlhttp://www.w3cschool.cc/python/python-exceptions.htmltry: a=b b=c except Exception,e: #except后面加异常种类 pr...
分类:
编程语言 时间:
2015-04-08 12:57:22
阅读次数:
121
本文来自:http://blog.csdn.net/xuejianwu/article/details/6931903七、聚合操作符聚合函数将在序列上执行特定的计算,并返回单个值,如计算给定序列平均值、最大值等。共有7种LINQ聚合查询操作符:Aggregate、Average、Count、Long...
分类:
其他好文 时间:
2015-04-07 17:29:17
阅读次数:
230
Given an array of integers, every element appears three times except for one. Find that single one.Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using ex...
分类:
其他好文 时间:
2015-04-05 14:42:18
阅读次数:
138
1 # coding: utf-8 # 使用Windows系统,首行'#!/usr/bin/env Pyton'无用,全部改为'# coding: utf-8' 2 3 'readtextfile.py -- read and display text file' 4 5 # get file...
分类:
编程语言 时间:
2015-04-04 11:52:42
阅读次数:
193
Given 2*n + 2 numbers, every numbers occurs twice except two, find them.ExampleGiven [1,2,2,3,4,4,5,3] return 1 and 5ChallengeO(n) time, O(1) extra sp...
分类:
其他好文 时间:
2015-04-04 06:49:31
阅读次数:
165
Everything is great about Ilya’s city, except the roads. The thing is, the only ZooVille road is represented as n holes in a row. We will consider the holes numbered from 1 to n, from left to right.Ily...
分类:
其他好文 时间:
2015-04-03 09:29:26
阅读次数:
145
Given an array of integers, every element appearsthreetimes except for one. Find that single one./** * 将整数所有位相加对3取余,剩下的就是只出现一次的数 * @param A ...
分类:
其他好文 时间:
2015-04-03 09:07:43
阅读次数:
121
一个程序要保持稳定运行必须要有异常处理,本文将简单介绍Python中的try…except..异常处理语句的使用。...
分类:
编程语言 时间:
2015-04-01 15:34:23
阅读次数:
169