Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to master the core technology of Java

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to master the core technology of Java". In the daily operation, I believe many people have doubts about how to master the core technology of Java. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubt of "how to master the core technology of Java". Next, please follow the editor to study!

There is no multi-inheritance in 1.Java, but interfaces are used instead of multi-inheritance

two。 When running a compiled program, the Java interpreter always starts with the code in the main method of the specified class, so there must be a main function in the executing code.

3.Java is a typical strongly typed language, that is, you must declare the type of a variable. There are eight types in Java, six numeric types (4 integers and 2 floats), one character type, and one boolean type.

4. Cast:

Int nx = (int) x; / / (syntax: enclose the target type in parentheses, followed by the variable to be converted)

5.Java cannot define local constants for individual methods, such as main methods, but can only define constants for a class that can be used by all methods of that class, so it is often called a class constant. Such as:

Class UsersConstants {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 be related to the keyword static final

6. A substring of a string:

String str = hello ""; String str1 = str.substring (0Jing 4); / / 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. The behavior, status, identity of an object

9. Process oriented and OOP

10. Constructor:

The object used to initialize a class must have the same name as the class, the constructor can have one or more parameters, the constructor can always be called with the new keyword, and a class can have multiple constructors (with different parameters).

11. Static method:

Static methods belong to the class and can be called without creating an instance object of the class. For example, console class:

X = Console.readDouble ()

The general syntax for using static methods of a class is: class name. Static method (parameter)

twelve。 Overloading (polymorphism):

If there are several identical methods under a class, but the parameters are different, this creates an overload of the method.

Java can overload any method, not just the constructor.

13. Type conversion of the object:

Manager boss = (Manager) args [0]

The difference between 14.Java array and Java vector:

Java arrays can store variables of any type, and Java vectors can only store instances of object classes.

Vector () / / constructs an empty vector with an initial capacity of 10, which doubles 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 expands. Void addElement (Object obj) / / A new element int size () is appended to the end of the vector.

15. A class with one or more abstract methods must be declared as an abstract class (keyword abstract)

/ / public abstract class HelloWorld () {public abstract void test (); / / Abstract method: an incomplete method with only declaration but no method body}

An abstract method requires that all non-abstract classes derived from an abstract class will 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)

The internal principles and ideas of 17.JDBC:

1) JDBC actually consists of two layers, and the upper layer is JDBC API, which communicates with the database driver and sends SQL statements to it. The database driver connects SQL statements to a relational database.

2) JDBC and database connection model:

At this point, the study on "how to master the core technology of Java" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report