Learning programming languages is mainly about learning several aspects: keywords, identifiers, annotations, variables, operators, statements, functions (functions), arrays. Learning Java is actually from these aspects.
Under the teacher's guidance I wrote the first Java program in my Life with notepad++:
Class helloworld{
public static void Main (string[] args) {
System.out.print ("Hello world!");
}
}
The result of this program running in DOS is Hello world!
After finishing this program, I was the first to say hello to the world of Java.
Note that when writing Java, the file name should be in. java as the suffix, in dos with JAVAC instructions to compile the source code into a bytecode file, if there is no error in the source, it will generate a. class file, which is known by the runtime computer.
When it comes to keywords, I think it can be said that really into the Java learning. Keywords in Java are used to name variables, symbolic constants, arrays, methods, classes, objects, interfaces, packages, and so on. In order to improve the program and readability, the General keyword should be named when the name is known, and the keyword has its own naming rules.
Keyword naming: 1, keywords consist of letters, numbers, underscores, $.
2, keywords can not start with a number
3, keyword is case sensitive
4, keywords cannot contain spaces
Say the keyword here to say by the way, I just touch Java is always the letter of the size of the specification to get headaches, but later learned that the original Java is generally used to denote the class name or variable name is the hump naming method, like hump a low, when the letter composed of many words to name the class name or variable name,
Usually the first letter of each word is capitalized, the following letter is lowercase, but the first letter of the variable name should be lowercase.
Say the keyword is the identifier, in fact, the identifier is a special keyword, here to explain the keyword must be lowercase, similar to the words in the language, has a special meaning, such as class classes, identifiers can not be used to name. (This refers to the class, in fact, this belongs to the object-oriented language features, Java is Object-oriented, and C is process-oriented, if I want to say the difference between the two, I think object-oriented more attention to the existence of the nature of the things themselves, as if to abstract people out is a class, human, And every specific person is an object, people have weight, height, and so many of the intrinsic properties of the Java package is a member variable, people can walk can jump and so this is the behavior is
The method in Java, as for the process, it literally, as if I had to go to bed such a thing, I can divide the matter into several parts, I have to change the pajamas, then take off my shoes, and then go to bed, each process can be written into a function, after executing these functions I was in bed. )
There are several basic data types in Java: Byte,short,int,long,char,float,double,boolean
That's all I want to say today, and when I want to write it will slowly add to the Java I know.
First knowledge of Java