Drive your career and don't let your career drive you. --Einstein
This content: objects, identifiers, keywords.
Java, as a language, must have his grammatical rules. One of the keys to learning programming language is to learn grammar rules, write sentences that conform to grammatical rules, and control computers to accomplish various tasks. In the syntax of programming languages, a collection of code that accomplishes a function can be called a program.
One, object:
An important feature of Java is object-oriented oriented (object), which is relative to process oriented.
The process-oriented approach describes the process:
The object-oriented approach describes this process:
When we put the refrigerator as an object, the problem becomes very simple, the refrigerator has a method is to take the milk method, you call this method, the return value of this method is a glass of milk. Equivalent to an intelligent refrigerator.
Object-oriented programming languages treat everything as objects: Everything is the object.
Second, identifiers (Indentifier)
The Java components, such as the class name, object name, method name, constant name, and so on, in the Java language require a name, and the names of these components are called identifiers (Indentifier).
A valid identifier has some naming conventions:
1. You must start with a letter, dollar sign, or underscore. Number cannot start
2, the first character can be any length of any combination containing numbers, letters, dollar signs, underscores.
3. Cannot use Java keywords and reserved words to do identifiers
4, identifiers are case-sensitive, and Z and Z are two different identifiers.
5. Unicode characters are treated as ordinary letters.
Unicode is an important common character encoding standard for interaction and display, and it covers the languages of the United States, Europe, the Middle East, Africa, India, Asia and the Pacific, as well as ancient prose and professional symbols.
For 5, learn about:
public class Text {public static void main (string[] args) {String Yangjiang = "Yangxi One"; System.out.println (Yangjiang);}}
The above code succeeds in printing out the words "Yangxi one".
Iii. Keywords (keywords)
Like all programming languages, Java has a set of built-in keywords that must never be used as identifiers. A total of 50 keywords in Java SE6 (keywords):
| Abstract |
Continue |
For |
New |
Switch |
| Assert |
Default |
Goto |
Package |
Synchronized |
| Boolean |
Do |
If |
Private |
This |
| Break |
Double |
Implements |
Protected |
Throw |
| Byte |
Else |
Import |
Public |
Throws |
| Case |
Enum |
instanceof |
Return |
Transient |
| Catch |
Extentds |
Int |
Short |
Try |
| Char |
Final |
Interface |
Static |
void |
| Class |
Finally |
Long |
Strictfp |
Volatile |
| Const |
Float |
Native |
Super |
While |
These words have a common feature: they are all lowercase and cannot be used as identifiers. Where instanceof is instance of the ligatures, STRICTFP is strict float point ligatures
There are three things that look like keywords, which are actually not the key things, they are literal values (literal), and the concept of literals is discussed later.
| True Boolean literals |
False Boolean literals |
Null literal value of NULL |
This is where we go, take your time and enjoy it
First Lecture: Java basic Syntax (i)