package testt;
public abstract class test2 {
public static void fun(StringBuffer sb1,StringBuffer sb2) {
sb1.append(sb2);
sb2=sb1;
}
public static void main(String[] args) {
StringBuffer a1 = new StringBuffer("we");
StringBuffer a2 = new StringBuffer("bush");
fun(a1,a2);
System.out.println("a1"+"="+a1+" "+"a2"+"="+a2);
}
}
输出结果:a1=webush a2=bush
package testt;
public class test1 {
static class Person{
static{
System.out.println("person init");
}
}
public static void main(String[] args) {
System.out.println(Person.class.equals(Person.class.getName()));
System.out.println("===========");
Person p1 = new Person();
Person p2 = new Person();
System.out.println(p1.getClass() == p2.getClass());
}
}
输出结果:false
===========
person init
true
package testt;
public class test3 {
static{
a=3;
}
static int a = 5;
public static void main(String[] args) {
System.out.println(a);
}
}
输出结果:5
基本类型 | 默认值 |
byte | 0 |
short | 0 |
int | 0 |
long | 0L |
float | 0.0f |
double | 0.0d |
char | 'u0000'(null) |
boolean | false |