Keywords: Some words that have been given Java meaning,class public static void
Keyword that defines the access permission modifier
Private protected public
Defining classes, functions, variable modifiers
Abstract final static synchronized
Keywords that define relationships between classes and classes
Extends implements
Define an instance, reference an instance, and judge an instance
New This super instanceof
Handling Exceptions
Try Catch finally throw throws
Keywords for the package
Package Import
Keywords for other modifiers
Native STRICTFP transient volatile assert
26 English letter case, 0-9 digits, _$ two symbols. But cannot start with a number and cannot use the keyword
Single-line note the Yellow River into the ocean in the daytime
/*
Multi-line comments, can also be used to narrow the scope of the troubleshooting!
The day depends on the mountain
The Yellow River into the ocean
*/
/**
Document annotations, which can be extracted using Java Javadoc
Used as a program manual
*/
Constants are values that cannot be changed (integers, decimals, Boolean Boolean constants, character constants ' strings "" null)
A variable is a storage area in memory that has its own name and type
byte short int long//integer type
float Double//floating-point type
char//character type
Boolean//Boolean type
Class//Classes
interface//interface
[]//array
Class vardemo{public static void Main (string[] args) {byte b=126;//character test int x=327899;//test int length System.out.println (b); SYSTEM.OUT.PRINTLN (x); }}
Execution results
D:\lab\java>javac 0908.java
D:\lab\java>java Vardemo
126
327899
Lass vardemo2//automatic type promotion with coercion type conversion {public static void main (string[] args)/* {byte x=9; int y=65535; Y=x+y; Add x y to System.out.println (y); } */{byte b=100; B= (Byte) (b+30);//coercion type conversion System.out.println (b); }}
D:\lab\java>javac 090802.java
D:\lab\java>java VarDemo2
-126
The ASCII code and the GBK code of a single letter or kanji will also be corresponding to the code table in memory to produce corresponding values
{System.out.println (' I ' +0); }
D:\lab\java>javac 090802.java
D:\lab\java>java VarDemo2
25105
An interesting case.
{byte b=4; BYTE b1=3; BYTE b2=5; B=B1+B2; System.out.println (b); }}
D:\lab\java>javac 090802.java
090802.JAVA:20: Error: Possible loss of precision
B=B1+B2;
^
Required: Byte
Found in: int
1 errors
Cause: B1 B2 is a variable, although the above defines a value, but not always fixed, such as the next time to assign a value b1=127? If the byte load range is exceeded, the precision is lost. Here is a concept that lets us understand the variables.
B=B1+B2//Right is not fixed, there is no way to judge
But int does not have this problem (only 32-bit cast high-level full discard is reserved)
Operator
Statement
Function
Array
This article is from "The Old artisan" blog, declined reprint!
Java SE02 Java language Fundamentals: keywords, identifiers, annotations