码迷,mamicode.com
首页 >  
搜索关键字:println    ( 5792个结果
Java随笔:容易搞混的long常量
看看这句代码输出什么:System.out.println(12345+5432l);乍看上去是:66666,实际输出的结果是17777。原因出在“5432l”最后一个是字母L的小写。要避免这样的情况,在使用long常量时,一定记得要用L大写。
分类:编程语言   时间:2014-12-31 22:44:28    阅读次数:284
Scala中的Implicit(隐式转换,隐式参数,隐式类)
文章来自:http://www.cnblogs.com/hark0623/p/4196452.html 转发请注明代码如下:/** * 隐式转换 隐式参数 隐式类 *///隐式转换class Implicit(a: A) { def Test: Unit = { println("Im...
分类:其他好文   时间:2014-12-31 21:21:55    阅读次数:208
Scala中的Apply
/** * Created by Administrator on 2014-12-31. */class ApplyTest { def apply() = "Apply customer" def test(): Unit = { println("test") }}object A...
分类:移动开发   时间:2014-12-31 07:37:11    阅读次数:162
Java随笔:表达式中隐藏的溢出
下面这段代码的输出是什么?long lvar1 = 24 * 60 * 60 * 1000 * 1000;long lvar2 = 24 * 60 * 60 * 1000;System.out.println(lvar1 / lvar2);一眼看去,应该是1000。实际的输出是什么呢?5为什么会得出...
分类:编程语言   时间:2014-12-30 22:06:39    阅读次数:170
Factorial Trailing Zeroes , 172题,可能是我没读清楚,还报错。
package com.x.xyz; public class HelloWorld { public static void main(String[] args) { System.out.println("Star !"); System.out.println(trailingZeroes(0)); System.out.println(trailingZeroes(1)...
分类:其他好文   时间:2014-12-30 19:06:46    阅读次数:151
172 Factorial Trailing Zeroes 过了。英文真不好读啊。
package com.x.xyz; public class HelloWorld { public static void main(String[] args) { System.out.println("Star !"); System.out.println(trailingZeroes(10)); System.out.println(trailingZeroes(1...
分类:其他好文   时间:2014-12-30 19:05:36    阅读次数:180
sCA
val buf = new ListBuffer[Int] val l1 = List(1,2,3,4,5) for (x<-l1) buf += x+1; println(buf) val l2 = buf.toList println(l2)
分类:其他好文   时间:2014-12-30 11:14:59    阅读次数:95
Java基础 之 System.getProperty()方法
Java基础 之 System.getProperty()方法大全 1 public static void main(String[] args) { 2 System.out.println("java版本号:" + System.getProperty("java.versi...
分类:编程语言   时间:2014-12-30 11:13:20    阅读次数:768
Java随笔:float、double精确性
通常会用float、double进行货币的计算。下面这个计算会输出什么?System.out.println(2.00 - 1.10);开始以为会是0.90,实际结果是:0.8999999999999999原因在于,不是所有的小数都可以用二进制浮点精确地表示。如何改造呢?用int、long进行计算,...
分类:编程语言   时间:2014-12-29 21:21:38    阅读次数:218
Java随笔:判断奇偶性
判断奇偶性很容易写出下面的代码:public static boolean isOdd(int num) { return num % 2 == 1;}这个思路遵循了数学判断奇数的标准:“对2取余等于1”。这段代码对负数属否成立呢?System.out.println(isOdd(-3));-...
分类:编程语言   时间:2014-12-29 20:01:26    阅读次数:302
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!