
面试题
文章平均质量分 68
kfengqingyangk
这个作者很懒,什么都没留下…
展开
-
java面试题之----无中间变量实现交换数字
题目:a=123;b=321,要求不使用第三个变量,让两个值互换。即要实现a=321;b=123; 思路: 方案一:利用这两个变量本身是数字,进行加减,从而实现交换 比如这样: a=b-a;//a=321-123;b=321 b=b-a;//a=321-123;b=321-(321-123)=123 a=a+b;//a=(321-123)+123=321;b=123 于是这样就实现了原创 2016-12-05 21:52:56 · 961 阅读 · 0 评论 -
Integer 中的缓存类IntegerCache
题目:public class test { public static void main(String[] args) { Integer c = 127, d = 127; Integer a = 128 , b = 128; Integer int1 = Integer.valueOf("100"); Integer int2 = Integer.value原创 2017-04-21 11:39:32 · 460 阅读 · 0 评论