Snail0369
知名会员
- 注册
- 2002-05-03
- 消息
- 1,954
- 荣誉分数
- 5
- 声望点数
- 148
今天开始看Java笔记了 自己总结了一点需要知道的概念, 如果有错 大家一起指出并修改
Call method
for static method className.methodName()
for instance method object.instantname()
type casting
implicit type casting [automaticly]
explicit type casting [ you have to claim it yourself to allow computer to do a type casting ]
example:
double d = 1.2;
float f = 1.5f;
d = f; // implicit type casting
f = (float)d; // explicit type casting
char c;
c = (char)(c - 'a' + 'A');
Math belongs to the package of java.lang,
all return types are double, except abs(x) whose return type is still the origin type of x.
boolean aaa = true; aaa is a flag
array can be a parameter and a return type
public static int [ ] reverse (int [ ] anArray) //page 31
int [ ] anIntArray = new int [10];//creat and initial to 0
type array arrayname create type array.length
int [ ] anArray = {1, 2, 3, 4};
int [ ] [ ] anArray = new int [m][n]; //m = row, n = column
++i one step, return i + 1 [ 号称速度比较快, 返回的是新的值 ]
i++ two steps, declare i and return i, then assignment i = i + 1 [ 返回的是老的值 ]
大家一起贴呀
Call method
for static method className.methodName()
for instance method object.instantname()
type casting
implicit type casting [automaticly]
explicit type casting [ you have to claim it yourself to allow computer to do a type casting ]
example:
double d = 1.2;
float f = 1.5f;
d = f; // implicit type casting
f = (float)d; // explicit type casting
char c;
c = (char)(c - 'a' + 'A');
Math belongs to the package of java.lang,
all return types are double, except abs(x) whose return type is still the origin type of x.
boolean aaa = true; aaa is a flag
array can be a parameter and a return type
public static int [ ] reverse (int [ ] anArray) //page 31
int [ ] anIntArray = new int [10];//creat and initial to 0
type array arrayname create type array.length
int [ ] anArray = {1, 2, 3, 4};
int [ ] [ ] anArray = new int [m][n]; //m = row, n = column
++i one step, return i + 1 [ 号称速度比较快, 返回的是新的值 ]
i++ two steps, declare i and return i, then assignment i = i + 1 [ 返回的是老的值 ]
大家一起贴呀