What knowledge content to learn in the basic stage of Java?

Java is an object-oriented programming language. People who are new to Java may feel abstract. Don’t worry, you can start with conceptual knowledge, first understand Java, and then thoroughly understand Java. In this section, let’s first understand the basic grammar knowledge of Java.

Object: An object is an instance of a class that has state and behavior. For example, a dog is an object, its states are: color, name, breed; behaviors are: wagging tail, barking, eating, etc.

Class: A class is a template that describes the behavior and state of a class of objects.

Method: A method is behavior, and a class can have many methods. Logical operations, data modification, and all actions are done in methods.

Instance Variables: Every object has unique instance variables, and the state of the object is determined by the values ​​of these instance variables.

java basic grammar knowledge

Java basic grammar knowledge:

1. Identifier

In the Java language, valid character sequences used to mark class names, object names, variable names, method names, type names, array names, and package names are called "identifiers"; identifiers consist of letters, numbers, underscores, dollars Symbols, and the first character cannot be a number; the Java language is case-sensitive;

Identifier naming rules: the first letter of the class name is capitalized, the variable name and method name use the hump notation method, the constants are all capitalized, multiple words are separated by "_", and the package name is all lowercase;

2. Keywords

In the Java language, some specialized words have been given special meanings, and these words can no longer be used to name identifiers. These proprietary words are called "keywords"; Java has 50 keywords and 3 reserved words , cannot be used to name identifiers; true, false, and null are not keywords, but reserved words, but they still cannot be used to name identifiers. Reserved words are keywords reserved by Java, and may be used as keywords in future upgrade versions keywords;

3. Java annotations

Similar to C/C++, Java also supports single-line and multi-line comments. Characters in comments will be ignored by the Java compiler.

4. Java blank line

Blank or commented lines are ignored by the Java compiler.

5. Inheritance

In Java, a class can be derived from other classes. If you want to create a class, and there is already a class with the properties or methods you need, then you can inherit the newly created class from that class. Using inherited methods, you can reuse methods and properties of existing classes without rewriting these codes. The inherited class is called a super class, and the derived class is called a sub class.

6. Interface

In Java, an interface can be understood as a protocol for communicating between objects. Interfaces play an important role in inheritance. The interface only defines the methods used by the derivation, but the specific implementation of the method depends entirely on the derived class.

Pay attention to several principles when writing Java programs: case-sensitive, Java is case-sensitive, which means that the identifier Hello is different from hello; for all classes, the first letter of the class name should be capitalized . If the class name consists of several words, the first letter of each word should be capitalized, such as MyFirstJavaClass; method name: all method names should start with a lowercase letter. If the method name contains several words, the first letter of each subsequent word is capitalized; source file name: the source file name must be the same as the class name. When saving the file, the class name should be used as the file name, and the suffix of the file name is .Java; Main method entry: All Java programs are executed from the public static void main method.

If you want to learn more about Java, are interested in Java, or are zero-based students who want to enter the industry, you can also directly watch the Java Zero-Basic Introductory Tutorial made by Dark Horse Programmers to learn about Java development environment construction and integrated development tools IntelliJ IDEA The detailed use, Java syntax and other knowledge.

 https://www.bilibili.com/video/BV1Cv411372m/?spm_id_from=333.999.0.0&vd_source=a9602decec8fcc27bc697e3fe6b51845

Supongo que te gusta

Origin blog.csdn.net/Blue92120/article/details/131938834
Recomendado
Clasificación