javase personal trash review notes 01 common English vocabulary keywords

Category keyword description
Access control private
protected
public public
default default
class, method and variable modifier abstract declaration abstract
class class
extends extension, inherits
final final value, immutable
implements implementation (interface)
interface interface
native local , Native method (non-Java implementation)
new, create
static static
strictfp strict, precise
synchronized thread, synchronized
transient transient
volatile volatile
program control statement break break out of the loop
case define a value for switch to select
continue continue
default default
do run
else otherwise
for Loop
if if
instanceof instance
return, return
switch, execute
while loop according to the value selection,
error handling assert, assert whether the expression is true or not
catch catch exception
Finally, if there is an exception, execute
throw Throw an exception object
throws Declare that an exception may be thrown
Try to catch the exception
Package related import Import
package package
Basic type boolean Boolean type
byte byte type
char character type
double double precision floating point
float single precision float Point
int integer
long long integer
short short integer
variable refers to super parent class, super class
this class
void has no return value
reserved keyword goto is a keyword, but cannot be used
const is a keyword, but cannot be used
null

this usage


public class persion{
    
    
private String name=null;
private int age;
public void setName(String name){
    
    
this.name=name;
}
public String getName(){
    
    
return name;
}
}
//在这bai个类中setName方法中第一个变量用this是为了和本方法的参数this做区别,表示这个name指的是Person这个类的name属性,而不是name参数,如果去掉这个this,执行完这个方法后,Person类的name属性仍然为null。

final usage

1. The final marked class cannot be inherited.
2. The final marked method cannot be overwritten by subclasses.
3. The final marked variable (member variable or local variable) is constant and can only be assigned once.

Guess you like

Origin blog.csdn.net/qq_45864370/article/details/108472228