1 java中:
byte 1(字节)
short 2
int 4
long 8
float 4
double 8
char 2
2 System.out.println(3+5+"a"+6+7);输出:8a67
3 开发与运行Java程序需要经过的三个主要步骤为 编辑源程序、编译生成字节码 和 解释运行字节码。
4 interface只能用public修饰。
5 字节流转换成字符流可以用InputStream和OutputStream来转换。
6 移位操作符只可用来处理整数类型,左移操作符(>)则按照右侧自定的位数将操作符左边的操作数右移(有符号数按符号扩展)
7 Java中增加了一种“无符号”右移操作符(>>>)它使用0扩展。无论正负。高位补0。
8 String s1=new String("a");
String s2=new String("a");
String s3="a";
String s4="a";
System.out.println(s1==s2);
System.out.println(s1.equals(s2));
System.out.println(s4==s3);
System.out.println(s4.equals(s3));
输出结果:false
true
true
true
9 static域的执行时间(第一次用类的时候执行一次,以后就不执行了)
public class Test1 {
/**
* @param args
*/
static{
System.out.println("Test1 is loading");
}
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("main method is executing");
new StaticCode();
new StaticCode();
}
}
class StaticCode{
static String country;
static{
country="china";
System.out.println("StaticCode is loading");
}
}
输出结果是:Test1 is loading
main method is executing
StaticCode is loading
byte 1(字节)
short 2
int 4
long 8
float 4
double 8
char 2
2 System.out.println(3+5+"a"+6+7);输出:8a67
3 开发与运行Java程序需要经过的三个主要步骤为 编辑源程序、编译生成字节码 和 解释运行字节码。
4 interface只能用public修饰。
5 字节流转换成字符流可以用InputStream和OutputStream来转换。
6 移位操作符只可用来处理整数类型,左移操作符(>)则按照右侧自定的位数将操作符左边的操作数右移(有符号数按符号扩展)
7 Java中增加了一种“无符号”右移操作符(>>>)它使用0扩展。无论正负。高位补0。
8 String s1=new String("a");
String s2=new String("a");
String s3="a";
String s4="a";
System.out.println(s1==s2);
System.out.println(s1.equals(s2));
System.out.println(s4==s3);
System.out.println(s4.equals(s3));
输出结果:false
true
true
true
9 static域的执行时间(第一次用类的时候执行一次,以后就不执行了)
public class Test1 {
/**
* @param args
*/
static{
System.out.println("Test1 is loading");
}
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("main method is executing");
new StaticCode();
new StaticCode();
}
}
class StaticCode{
static String country;
static{
country="china";
System.out.println("StaticCode is loading");
}
}
输出结果是:Test1 is loading
main method is executing
StaticCode is loading