Java core technology, java Core Technology 2
1. Java does not have multiple inheritance, but uses interfaces instead of multiple inheritance.
2. When running a compiled program, the Java interpreter always runs from the code in the main method of the specified class. Therefore, the Execution Code must have a main function.
3. java is a typical strong type language, that is, the type of the variable must be declared. Java has eight types and six numerical types (four integer types and two floating point types), a character type, and a boolean type.
If you want to learn java, you can come to this group. The first is the second, the second, the middle is the second, the second is the second, and the last is the ninth and Sixth. There are a lot of learning materials to download.
4. Forced type conversion:
Int nx = (int) x; // (Syntax: Enclose the target type with parentheses, followed by the variable to be converted );
5. Java cannot define local constants for separate methods, such as the main method. Instead, Java can only define constants for classes and can be used by all methods of the class. Therefore, it is usually called a class constant. For example:
Class UsersConstants {2 public static final double g = 32; public static final double main (String [] args) {System. out. println (g );}}
Note: constants are defined outside the main method and must have the keyword static final;
6. substring of the string:
String str = hello ""; String str1 = str. substring (); // output hell
7. Do not use the = Operator to test whether two strings are equal. This operator can only determine whether two strings exist in the same position.
Use equals.
String str = "hello"; str. equals ("hell"); // return false;
8. Object behavior, status, and identifier
9. process-oriented and OOP
10. constructor:
Object used to initialize the class, the class name must be the same, the constructor can have one or more parameters, the new keyword is always used to call the constructor, and a class can have multiple Constructor (different parameters ).
11. Static Method:
Static Methods belong to Classes. You can call static methods without creating class instance objects. For example, the console class:
X = Console. readDouble ();
The general syntax for using static methods of classes is: Class Name. Static Method (parameter );
12. Overload (polymorphism ):
If there are several identical methods under a class, but the parameters are different, a method overload is formed.
Java can overload any method, not just constructor.
13. Object type conversion:
Manager boss = (Manager) args [0];
14. Differences between Java arrays and Java vectors:
Java Arrays can store any type of variables. Java vectors can only store instances of object classes.
Vector () // construct an empty Vector with an initial capacity of 10. When the current capacity is exceeded, the capacity doubles. Vector (int initialcapicity) Vector (int initialcapicity, int n) // when the current Vector is exceeded, the number of current vectors + n extension. Void addElement (Object obj) // append a new element int size () to the end of the Vector ()
15. classes with one or more abstract methods must be declared as abstract classes (abstract keywords)
// Public abstract class HelloWorld () {public abstract void test (); // abstract method: an incomplete method, with only declarations but no method bodies}
Abstract METHODS require that all non-abstract classes derived from abstract classes implement this abstract method. Abstract methods are implemented in subclass as placeholder methods.
16. The abstract class cannot be instantiated (because the abstract class may contain incomplete abstract methods)
17. Internal principles and ideas of JDBC:
1) JDBC is actually composed of two layers. The upper layer is the jdbc api, which communicates with the database driver and sends SQL statements to it. The database driver connects SQL statements to relational databases.
2) JDBC and database connection model: