OCA
private methods are always hidden in a subclass.
variables may only be hidden, regardless of the access modifier.
The interface variable amount is correctly declared, with public and static being assumed and automatically inserted by the compiler
Although all variables in interfaces are assumed to be public static final, abstract classes may contain them as well
though an instance of an object that implements an interface inherits java.lang.Object, the interface itself doesn‘t; otherwise, Java would support multiple inheritance for objects, which it doesn‘t.
The trick here is that the method fly() is marked as private in the parent class Bird, which means it may only be hidden, not overridden. With hidden methods, the specific method used depends on where it is referenced.
Runtime exceptions can be thrown in any method
ArrayIndexOutOfBoundsException, IllegalArgumentException, and NumberFormatException are runtime exceptions.
the method called inside the try block doesn‘t declare an IOException to be thrown. The compiler realizes that IOException would be an unreachable catch block.
IOException is a subclass of Exception, but not a RuntimeException.
All array types are reference variables. Although int is a primitive type, int[] is still a reference type.
What data types allowed in a switch statement?
In a StringBuilder, the length can be less than or equal to the capacity. What is capacity??
NumberFormatException is RuntimeException ?
Overload: It prefers an auto boxed parameter over a vararg parameter.
Method has protected access, which means it can only be accessed from a subclass reference or in the same package.
Why abstract class can have constructor method since it cannot be instantiated??
IllegalArgumentException is a runtime exception.
Java is pass by value, reassignments to method parameters are not seen by caller.
An interface method can be overridden with an abstract method that follows the particular rules for method overriding.
A class implements two interfaces can have duplicate abstract and static method
A class implements two interfaces can only have a duplicate default method if the class override the default method.
The initial capacity of StringBuilder is 16.
byte is -127 , 128
Two -dimention arrays, the second length won’t limit the length??
int [][] ints2 = new int[1][1];
ints2[0] = new int[] {4, 5, 6};
NegativeArraySizeException
NumberFormatException is RuntimeException.
?? Interface I
I i = new I(){};
Public StringBuilder append(char[] str, int offset, int len)
Error/exception throw by JVM??
IllegalStateException (which is a RuntimeException) and AssertionError can be thrown programmatically. ??
A fully qualified means using the complete package details when access a Java class.
The native keyword is applied to a method to indicate that the method is implemented using native code using JNI (Java Native Interface) ??
What is keyword - transient ?
Type of inner class |
Description |
---|---|
Static or static nested class | Is a static member of its enclosing class and can access all the static variables and members of its outer class |
Inner or member class | Is an instance member of its enclosing class. It can access all the instance and static members of its outer class, including private members. |
Method local inner class | Is defined within a method. Local inner classes are local to a method. They can access all the members of a class, including its private members, but they can be accessed only within the method in which they’re defined. |
Anonymous inner class | Is a local class without a name |
Class |
Method |
Description |
---|---|---|
java.util.Calendar | getInstance() | Gets a calendar using the default time zone and locale. |
java.util.Arrays | asList() | Returns a fixed-size list backed by the specified array. |
java.util.ResourceBundle | getBundle() | Overloaded versions of this method return a resource bundle using the specified base name, target locale, class loader, and control. |
java.sql.DriverManager | getConnection() | Establishes and returns a connection to the given database URL. |
java.sql.DriverManager | getDriver() | Attempts to locate and return a driver that understands the given URL. |
java.sql.Connection | createStatement() | Overloaded version of this method creates a statement object for sending SQL statements to the database and generates ResultSet objects with the given type, concurrency, and holdability. |
java.sql.Statement | executeQuery() | Executes the given SQL statement, which returns a single ResultSet object. |
java.text.NumberFormat | getInstance() getNumberFormat() | Returns a general-purpose number format for the current default locale. |
java.text.NumberFormat | getCurrencyInstance() | Returns a currency format for the current default locale. |
java.text.NumberFormat | getIntegerInstance() | Returns an integer format for the current default locale. |
java.util.concurrent.Executors | newFixedThreadPool() newCachedThreadPool() newSingleThreadExecutor() | Creates a thread pool. |
The Java compiler might need to create additional methods, referred to as bridge methods, as part of the type erasure process.
Package java.util.concurrent |
java.util analog |
---|---|
BlockingQueue | Queue |
ArrayBlockingQueue | Queue |
LinkedBlockingQueue | Queue |
ConcurrentMap | Map |
ConcurrentHashMap | HashMap |
ConcurrentSkipListMap | TreeMap |
CopyOnWriteArrayList | ArrayList |
LinkedBlockingDeque | Deque |
原文:https://www.cnblogs.com/drilld/p/10872170.html