When to use Assert.
assertion(断言)在软件开发中是一种常用的调试方式,很多开发语言中都支持这种机制。在实现中,assertion就是在程序中的一条语句,它对一个boolean表达式进行检查,一个正确程序必须保证这个boolean表达式的值为true;如果该值为false,说明程序已经处于不正确的状态下,系统将给出警告或退出。一般来说,assertion用于保证程序最基本、关键的正确性。assertion检查通常在开发和测试时开启。为了提高性能,在软件发布后,assertion检查通常是关闭的。
What is a GC? Why do you have a GC?
GC is the meaning of garbage collection (Gabage Collection), memory processing is where programmers are prone to problems, forgetting or wrong memory recycling can cause program or system instability or even crashes, The GC functionality provided by Java can automatically monitor whether an object exceeds the scope to achieve the purpose of automatically reclaiming memory, and the Java language does not provide a way to release the displayed operation of the allocated memory.
Short S1 = 1; S1 = s1 + 1; what's wrong? Short S1 = 1; S1 + = 1; what's wrong?
short s1 = 1; s1 = s1 + 1; (s1+1运算结果是int型,需要强制转换类型)
Short S1 = 1; S1 + = 1; (can be compiled correctly)
Math.Round (11.5) how much? Math.Round (-11.5) how much?
Math.round(11.5)==12
Math.Round (-11.5) ==-11
The round method returns the longest integer closest to the parameter, and the parameter adds 1/2 to its floor.
string s = new string ("XYZ"), and several string Object are created?
两个
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
5 questions per day (v) Java basics