java pre Addendum - compilation and keyword writing specifications

/ *
1.java programming - compile - run process of
writing: the java code written saved in the source file with .java suffix in the
compilation: use java.exe command to compile java source files. Format source file name .java javac
run: java.exe using the command interpreter to run our bytecode files. Format: java class name
2. a java source file can declare more than one class, but can only have a class is declared as public
class name is declared to be consistent with the file name
3, entry program is main () method , fixed format
4, output statement:
System.out.println (); output data back to the first line, the contents do not enter the brackets can play the role of wrap
of System.out.print (); only the data does not wrap
5, performed for each end of the statement with a semicolon; end
6, the compilation process, then the compiler generates byte code of one or more files, the file name of the same bytecode class files and name

*/

class hellochina{
	public static void main(String[] args){
		//arguments:参数 名称可以改变为其他 String后[]位置可以改到参数后面 String abc []
		System.out.println("Hello,Word!");
		System.out.println("Hello,Word!");
		System.out.print("Hello,Word!");
		System.out.print("Hello,Word!");
		System.out.println();
		System.out.print("Hello,Word!");
		System.out.println();//起到换行作用
		System.out.println("Hello,Word!");
	}
}
class person{
}
class animal{
}

/ *
Keywords (keywords): java language to indicate special meaning string (word), as a special purpose.

Features: keywords lowercase all characters

typical

Used to define the data type of the keyword
class interface enum byte short int long float double char boolean void
is used to define flow control keywords
if else switch case default while do for break continue return
keyword is used to define access rights of
private protected public
is used to define classes, functions, variables modifier key
abstract final static synchronized
keyword is used to define the relationship between classes and class
extends implements
keywords for exception handling
try catch finally throw throws
keyword for packet
package import
other modifier keywords
native strictfp transient volatile assert
a literal defined data type value of
true false null this is not strictly a keyword, but the identifier naming should avoid these three
reserved words (reserved words); existing java version is not used, but later may be used as a key identifier when naming avoid the use of reserved words.
For example goto const

Identifier (Identifier)

java sequence of characters used for a variety of variables, methods and the like become a feature identifier naming

Memory skills: those who own place from the name of the call identifier. Class name, package name, variable name, method name (function name) interface name ...

Define the legal identifier rules:
1, the case of 26 English characters, 0-9, or _ 5 Composition example _5 DF1
2, can not start with a number 1call No
3, can not use the keywords and reserved words, but can contain keywords and reserved words forint can be
4, java strictly case-sensitive, but the length is unlimited keywords in uppercase characters on class may, for example the iNT
. 5, no space identifier cc nb not
examples of
which of the following may be used as an identifier Test miles a ++ --a 4 # R $ 4 ## 4 apps xy radius staticclass Public int class

Identifier naming convention
Package name: multi-word when all letters are lowercase: xxxyyyzzz
class name, interface name: multi-word, all words capitalized: XxxYyyZzz
variable name method name: Multi-word is the first word in the first lowercase letters, and the second word after the word capitalized: xxxYyyZzz
constant name: All the letters are capitalized. When many words each word with an underscore: XXX_YYY_ZZZ.
Note 1; when a name, in order to improve readability, to try to make sense, "see the name to know Italian."
Note 2: java using unicode character set, so the identifier can also use Chinese characters declaration, but not recommended.
Since the above reference "Code neat way"
not in accordance with this name can be compiled to run through, but more structured specification can be named, to improve readability.

*/

发布了47 篇原创文章 · 获赞 1 · 访问量 1041

Guess you like

Origin blog.csdn.net/wisdomcodeinside/article/details/104458140