1. 字符串与整型的相互转换
- String a = String.valueOf(2); //integer to numeric string
- int i = Integer.parseInt(a); //numeric string to an int
2,得到当前方法的名字
public class MethodName {
private void IamAMethod(){
String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
System.out.println(methodName);
}
public static void main(String[] args) {
MethodName mName=new MethodName();
mName.IamAMethod();
}
}
3,