摘要: 题目描述:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see be... 阅读全文
posted @ 2015-08-02 16:44 Z小t 阅读(187) 评论(0) 推荐(0)
摘要: 题目描述:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return –321解决方法:public int reverse(int value) { int r... 阅读全文
posted @ 2015-07-26 16:51 Z小t 阅读(128) 评论(0) 推荐(0)
摘要: 单例模式的写法 1. 懒汉模式(线程不安全) 懒汉模式:顾名思义就是需要使用的时候才实例化; 线程不安全:设想两个线程同时都运行到判断instance是否等于null的if语句,并且instance的确没有被创建,那么这两个线程都会创建一个实例(执行:instance = new Singleton1),此时就不满足单例模式的要求。 package Singleton; public cla... 阅读全文
posted @ 2015-07-26 11:13 Z小t 阅读(221) 评论(0) 推荐(0)