Java Core technology-17 important points of knowledge

Source: Internet
Author: User

No more inheritance in 1.Java, instead of multiple inheritance with interfaces
2. When running a compiled program, the Java interpreter always executes from the code in the main method of the specified class, so there must be a main function in the execution code.
3.Java is a typical strongly typed language, that is, you must declare the type of the variable, there are 8 types in Java, 6 numeric types (4 integers and 2 floating-point), a character type, and a Boolean type.
Want to learn Java can come to this group, the first is 220, the middle is 142, the last is 906, there is a large number of learning materials can be downloaded.
4. Force type conversions:
int NX = (int) x; (Syntax: Enclose the target type in parentheses, followed by the variable to be converted);
5.Java You cannot define a local constant for a separate method, such as the main method, but you can define a constant for the class, which is used by all methods of the class, so it is commonly referred to as a class constant. Such as:
Class usersconstants{2public static final Double g = +; public static final double main (string[] args) {System.out.print ln (g);}}
Note: Constants are defined outside the main method and must have a keyword static final;
6. Substring of string:
String str = Hello ""; String str1 = str.substring (0,4);//Output Hell
7. Do not use the = = operator to test whether two strings are equal, the operator can only determine whether two strings exist in the same position.
With equals.
String str = "Hello"; Str.equals ("hell");//return false;
8. Behavior, status, identity of the object
9. Process-oriented and OOP

10. Constructors:
The object used to initialize the class must be the same as the name of the class, the constructor can have one or more parameters, always call the constructor with the new keyword, and a class can have more than one constructor (the parameters are different).
11. Static Method:
Static methods are classes, and static methods can be called without creating an instance object of the class. such as Console class:
x = Console.readdouble ();
The general syntax for using a static method of a class is: the class name. static methods (parameters);
12. Overloading (polymorphism):
If there are several identical methods under a class, but the parameters are different, then the overloads of the methods are formed.
Java can overload any method, not just a constructor.
13. Type Conversions for objects:
Manager boss = (manager) args[0];
The difference between a 14.Java array and a Java vector:
Java arrays can store any type of variable, and Java vectors can only store instances of an object class.
Vector ()//constructs an empty vector with an initial capacity of 10, doubling the capacity when the current capacity is exceeded. Vector (int initialcapicity) vector (int initialcapicity,int n)//when the current vector is exceeded, the current vector number +n expanded. void AddElement (Object obj)//Append a new element to the tail of the vector int size ()
15. A class with one or more abstract methods, which must be declared as an abstract class (keyword abstract)
Public abstract class HelloWorld () {public abstract void test ();//abstract method: is an incomplete method with only a declaration and no method body}
Abstract methods require that all non-abstract classes derived from an abstract class implement the abstract method. Abstract methods are implemented as placeholder methods in subclasses.
16. Abstract classes cannot be instantiated (because abstract classes may contain incomplete abstract methods)
17.JDBC of internal principles and ideas:
1) JDBC actually has 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 the SQL statement to the relational database.
2) JDBC vs. database connection model:

Java Core technology-17 important points of knowledge

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.