摘要: http://www.cnblogs.com/artech/archive/2007/03/04/663728.html 关于字符串的驻留的机制,对于那些了解它的人肯定会认为很简单,但是我相信会有很大一部分人对它存在迷惑。在开始关于字符串的驻留之前,先给出一个有趣的Sample: Code Snip 阅读全文
posted @ 2019-04-03 16:33 kissrule 阅读(165) 评论(0) 推荐(0) 编辑
摘要: https://www.golinuxcloud.com/java-interview-questions-answers-experienced-2/ 75. What is the meaning of Immutable in the context of String class in Ja 阅读全文
posted @ 2019-04-03 16:20 kissrule 阅读(201) 评论(0) 推荐(0) 编辑
摘要: StringBuffer类和String一样,也用来代表字符串,只是由于StringBuffer的内部实现方式和String不同,所以StringBuffer在进行字符串处理时,不生成新的对象,在内存使用上要优于String类。 所以在实际使用时,如果经常需要对一个字符串进行修改,例如插入、删除等操 阅读全文
posted @ 2019-04-03 16:08 kissrule 阅读(146) 评论(0) 推荐(0) 编辑
摘要: What are the different types of References in Java? In Java, there are four types of references: 阅读全文
posted @ 2019-04-03 15:27 kissrule 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Volatile修饰的成员变量在每次被线程访问时,都强迫从主内存中重读该成员变量的值。而且,当成员变量发生变化时,强迫线程将变化值回写到主内存。这样在任何时刻,两个不同的线程总是看到某个成员变量的同一个值。 Java语言规范中指出:为了获得最佳速度,允许线程保存共享成员变量的私有拷贝,而且只当线程进 阅读全文
posted @ 2019-04-03 15:08 kissrule 阅读(274) 评论(0) 推荐(0) 编辑
摘要: How is Abstraction different from Encapsulation? Abstraction happens at class level design. It results in hiding the implementation details. Encapsula 阅读全文
posted @ 2019-04-03 13:49 kissrule 阅读(169) 评论(0) 推荐(0) 编辑
摘要: What is the difference between method overloading and method overriding in Java? Differences between method overloading and overriding are: Method ove 阅读全文
posted @ 2019-04-03 13:39 kissrule 阅读(228) 评论(0) 推荐(0) 编辑
摘要: java 中 静态块的作用 (一)java 静态代码块 静态方法区别一般情况下,如果有些代码必须在项目启动的时候就执行的时候,需要使用静态代码块,这种代码是主动执行的;需要在项目启动的时候就初始化,在不创建对象的情况下,其他程序来调用的时候,需要使用静态方法,这种代码是被动执行的. 静态方法在类加载 阅读全文
posted @ 2019-04-03 11:36 kissrule 阅读(511) 评论(0) 推荐(0) 编辑
摘要: Why there are no pointers in Java? In Java there are references instead of pointers. These references point to objects in memory. But there is no dire 阅读全文
posted @ 2019-04-03 11:02 kissrule 阅读(230) 评论(0) 推荐(0) 编辑
摘要: How aggregation and composition are different concepts? In OOPS, Aggregation and Composition are the types of association relations. A composition is 阅读全文
posted @ 2019-04-03 10:58 kissrule 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Main principles of Object Oriented Programming (OOPS) are: Abstraction Encapsulation Inheritance Polymorphism 阅读全文
posted @ 2019-04-03 09:49 kissrule 阅读(116) 评论(0) 推荐(0) 编辑