
java
文章平均质量分 64
Michael_yan2015
这个作者很懒,什么都没留下…
展开
-
java中的移位运算符
Java中移位操作符有三个:>、>>>,分别叫做左移位操作符、有符号右移位操作符、无符号右移操作符。左位移操作符():无论是有符号数还是无符号数,都低位补0。有符号右移位操作符(>>):用符号扩展,为正高位补0,为负高位补1。无符号右移操作符(>>>):无论是有符号数还是无符号数,都高位补0,称为零扩展。注意移位预处理char、byte、原创 2016-05-13 21:25:29 · 270 阅读 · 0 评论 -
[Java] override VS overload
override、overload为三种Java多态实现方式之二(另有接口实现)override(重写,覆盖)override基于类与类之间的继承关系,子类修改父类已有相同方法签名的方法的实现。overload(重载)overload指在类继承体系中的方法名相同,其方法签名相异的现象。Note: - override和overload的存在均基于在当前类中存在另一可访...原创 2018-03-29 22:53:39 · 179 阅读 · 0 评论 -
java中Arrays.parallelSort和Arrays.sort性能对比
Arrays.parallelSortjava8新增的并行排序算法,基于fork/join框架。Arrays.sort为串行排序现在对这两个算法针对不同的数据规模进行性能对比,先上结果后附代码//先让数据规模按2的指数幂递增limit:2 parallelSort: 0ms serialSort: 0mslimit:4 parallelSort: 0ms serialSort: 0m原创 2016-11-24 11:43:29 · 14555 阅读 · 2 评论 -
java-finally详解
今晚京东笔试,各种finally,有点迷糊,所以在这里总结一下。1、如果在try块或者catch块有System.exit(0),直接退出,不执行finally代码块public class Main { void fun(){ int c=0; try{ System.out.println("try "); System.exit(0); }catch(E原创 2016-09-05 23:39:06 · 432 阅读 · 0 评论 -
BigInteger详解
BigInteger:Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in two's-complement notation (like Java's primitive integer types). BigInteger provides an原创 2016-09-13 08:39:43 · 2778 阅读 · 0 评论 -
Timer和TimerTask总结
Timer:A facility for threads to schedule tasks for future execution in a background thread. Tasks may be scheduled for one-time execution, or for repeated execution at regular intervals.(使用线程来实现定时执行原创 2016-09-13 08:07:39 · 331 阅读 · 0 评论 -
最长上升子序列
给定一个整数序列,找到最长上升子序列(LIS),返回LIS的长度。您在真实的面试中是否遇到过这个题? Yes说明最长上升子序列的定义:最长上升子序列问题是在一个无序的给定序列中找到一个尽可能长的由低到高排列的子序列,这种子序列不一定是连续的或者唯一的。https://en.wikipedia.org/wiki/Longest_increasi原创 2016-07-04 14:06:01 · 348 阅读 · 0 评论 -
编辑距离
给出两个单词word1和word2,计算出将word1 转换为word2的最少操作次数。你总共三种操作方法:插入一个字符删除一个字符替换一个字符您在真实的面试中是否遇到过这个题? Yes样例给出 work1="mart" 和 work2="karma"返回 3分析:动态规划:用dp(i, j)表示word1的字串(原创 2016-07-04 11:32:01 · 271 阅读 · 0 评论 -
k数和
给定n个不同的正整数,整数k(k 在这n个数里面找出K个数,使得这K个数的和等于目标数字,求问有多少种方案?您在真实的面试中是否遇到过这个题? Yes样例给出[1,2,3,4],k=2, target=5,[1,4] and [2,3]是2个符合要求的方案分析:动态规划dp(i , j , k)表示前i个数原创 2016-07-04 11:19:19 · 2253 阅读 · 2 评论 -
List和Set集合中iterator的fail-fast特性之区别
刚才看到一个问题,关于List和Set集合中iterator的fail-fast特性先上代码:List集合:public class Test { public static void main(String[] args){ List L = new LinkedList(); L.add("aaa"); L.add("bbb"); L.add("ccc");原创 2016-05-18 01:23:43 · 822 阅读 · 0 评论 -
[Java] Overriding and Hiding Methods
If a subclass defines a static method with the same signature as a static method in the superclass, then the method in the subclass hides the one in the superclass.The distinction between hiding a s...转载 2018-03-29 23:05:44 · 214 阅读 · 0 评论