爱奇艺
1、int a=5;int b=7;int rst=(a++)+(b++);rst=?
解析:x++操作符相当于一个函数调用,x是函数参数,++在x之后返回值是x,++在x之前返回的的x+1。所以rst=12;
2、以中文为主的文章,以下哪种编码方式使存储空间最小?
A、GBK B、UTF-8 C、Unicode D、UCS-4
解析:Unicode为确定了所有字符(包括中文)的对应二进制数,但没有规定应该如何存储,UTF-8是对unicode字符的一种变长存储方式,英文1个字节,中文3个字节,GBK对所有的中文用2个字节存储,但不同通用,GBK编码的汉字在其他国家是乱码,UCS-4是UTF-32统一用4个字节存储。所以答案应该是A。
IGT
public class Test{
public static void main(String[] args){
Base b=new Derived();
}
}
class Base{
static{
System.out.println("6");
}
{
System.out.println("5");
}
public Base(){
System.out.println("4");
}
}
class Derived extends Base{
static{
System.out.println("3");
}
{
System.out.println("2");
}
public Derived(){
System.out.println("1");
}
}
输出:
6 3 5 4 2 1