From: https://www.ibm.com/developerworks/lotus/library/ls-Java_access_pt1/index.html Overview Java access to the Domino Objects is through the high-level package lotus.domino. The interfaces in this package are implemented in one of two other package…
Access Levels Modifier Class Package Subclass World public Y Y Y Y protected Y Y Y N no modifier Y Y N N private Y N N N The following table shows where the members of the Alpha class are visible for each of the access modifiers that can be applied t…
Obey the general contract when overriding equals 先了解equals 和 == 的区别,如果不重写equals, equals比较的仅仅只是是否引用同一个对象,==更多的是比较基本数值.当我们创建一些对象的时候. 当对象是单例模式不需要进行 equals 重写. Reflexive: For any non-null reference values x,x.equals(x) must return true. Symmetric:For any…
//一段优美的例子 import java.util.Scanner; import java.util.InputMismatchException; public class DevideByZeroWithoutNoException1{ public static int quotient(int numerator,int denominator) throws ArithmeticException { return numerator/denominator; } public s…
This chapter concerns creating and destorying objects : when and how to create them, when and how to avoid creating them, how to ensure they are destoryed in a timely manner, how to manage any cleanup actions that must precede their destruction.…
String s = new String("stringette"); // Don't do this. This will create an object each time Vs String s = "stringette"; class Person { private final Date birthDate; // Other fields, methods, and constructor omitted /** * The starting a…
Access control ( or implementation hiding) is about "not getting it right the first time." refactoring a primary consideration in object-oriented design is to "separate the thins that change from the thing that stay the same To solve this p…
1. Translating Java Classes to Scala Classes Example 1: # a class declaration in Java public class Book{} # Scala equivalent of a class declaration class Book Example 2: # a Java class with a Construtor public class Book{ private final int isbn; priv…
I/O The original byte-oriented library was supplemented with char-oriented, Unicode-based I/O classes. It's rather important to understand the evolution of the I/O library. The File class "FilePath" would have been a better name for the class. I…
Hi guys, I am happy to tell you that I am moving to the open source world. And Java is the 1st language I have chosen for this migration. It's a nice chance to read some great books like "Effective Java 2nd Edition" and share the note for what I…
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLists and ArrayLists (and Vectors) (Page last updated May 2001, Added 2001-06-18, Author Jack Shirazi, Publisher OnJava). Tips: ArrayList is faster than…
来自:http://www.jesperdj.com/2016/01/08/scala-access-modifiers-and-qualifiers-in-detail/ Just like Java and other object-oriented programming languages, Scala has access modifiers to restrict access to members of classes, traits, objects and packages.…
Usually, when you develop a simple, concurrent-programming application in Java, you create some Runnable objects and then create the corresponding Thread objects to execute them. If you have to develop a program that runs a lot of concurrent tasks, t…
Concurrency However, becoming adept at concurrent programming theory and techniques is a step up from everything you've learned so far in this book, and is an intermediate to advanced topic. In practice, however, it's much easier to write concurrent…
From Thinking in Java 4th Edition 内部类 public class Parcel1 { class Contents { private int i = 11; public int value { return i;} } class Destination { private String label; Destination(String whereTo) { label = whereTo; } String readLabel() { return l…
Architectural Overview A modern optimizing compiler can be logically divided into four parts: The compiler front end The front end includes the scanner and parser which read the Java source and build an abstract syntax tree (AST) representation o…
Implementation with Java From:http://jcsc.sourceforge.net In general, follow the Sun coding conventions.These are available at java.sun.com/docs/codeconv/index.html (the code in this book follows these conventions as much as I was able). These are us…