单例设计模式用来创建唯一的对象,有些时候我们只需要一个对象,如:线程池,缓存,对话框,注册表,日志对象,等等。这就需要单例设计模式来完成。不用多说,直接上代码。public 
class TestSingle {	private static TestSingle single = null;	pri...
                            
                            
                                分类:
其他好文   时间:
2014-05-23 03:48:01   
                                阅读次数:
235
                             
                    
                        
                            
                            
                                import java.util.Random;
public class  NumberSort{
	/**
	* 私有构造方法,禁止实例化
	*/
	private NumberSort(){
		super();
	}
	/**
	* 冒泡排序
	* 比较相邻的元素。如果第一个比第二个大,就叫唤他们两个位置。
	* 对每一组相邻的元素作同样的工作,从开始的第一对到结束后的最后一对,这样剩下的...
                            
                            
                                分类:
编程语言   时间:
2014-05-23 02:13:51   
                                阅读次数:
364
                             
                    
                        
                            
                            
                                为什么会有线程同步的概念呢?为什么要同步?什么是线程同步?先看一段代码:package com.maso.test;
public class ThreadTest2 implements Runnable{
	private TestObj testObj = new TestObj();
	
	public static void main(String[] args) {
		Thread...
                            
                            
                                分类:
移动开发   时间:
2014-05-23 01:29:34   
                                阅读次数:
333
                             
                    
                        
                            
                            
                                Employee.java
package com.study;
public class Employee {
	private int id;
	private String firstName;
	private String lastName;
	private int salary;
	public Employee() {
	}
	public Emplo...
                            
                            
                                分类:
系统相关   时间:
2014-05-23 01:28:18   
                                阅读次数:
370
                             
                    
                        
                            
                            
                                /// 
/// 判断手机用户UserAgent
/// 
/// 
private bool IsMobile()
{
    
    HttpContext context = HttpContext.Current;
    if (context != null)
    {
        HttpRequest request = context.Request;
        i...
                            
                            
                                分类:
移动开发   时间:
2014-05-23 01:06:25   
                                阅读次数:
258
                             
                    
                        
                            
                            
                                1、/* MediaPlayer对象 */	public 
MediaPlayer	mMediaPlayer = null;/* 构建MediaPlayer对象 */mMediaPlayer= new 
MediaPlayer();/* 播放列表 */	private List mMusicList ....
                            
                            
                                分类:
其他好文   时间:
2014-05-22 16:52:35   
                                阅读次数:
277
                             
                    
                        
                            
                            
                                1.Eucalyptus:Eucalyptus is a Linux-based 
software architecture that implements scalable private and hybrid clouds within 
your existingIT infrastructur...
                            
                            
                                分类:
其他好文   时间:
2014-05-22 16:52:01   
                                阅读次数:
263
                             
                    
                        
                            
                            
                                1、定义/* 录制的音频文件 */	private File 
mRecAudioFile;	private File mRecAudioPath;	/* MediaRecorder对象 */	private 
MediaRecorder	mMediaRecorder;	/* 录音文件列表 */...
                            
                            
                                分类:
其他好文   时间:
2014-05-22 15:20:23   
                                阅读次数:
236
                             
                    
                        
                            
                            
                                /* 播放录音文件 */private void playMusic(File 
file){Intent intent = new 
Intent();intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.setAction(android.con...
                            
                            
                                分类:
其他好文   时间:
2014-05-22 15:18:27   
                                阅读次数:
269
                             
                    
                        
                            
                            
                                1、定义private int mVideoWidth;	private int 
mVideoHeight;private MediaPlayer mMediaPlayer;	private SurfaceView 
mPreview;	private SurfaceHolder hol...
                            
                            
                                分类:
其他好文   时间:
2014-05-22 14:54:22   
                                阅读次数:
269