- 扭转自我评价,便可让行为发生巨大变化
使用静态属性必须以类名作前缀。
正确答案: B 你的答案: B (正确)java
A 正确
B 错误less
1 若是是本类使用,能够直接就用静态变量名。 2 若是是其余类使用,可使用类名来调用,也能够建立一个实例对象来调用。 3 若是静态变量所在的类是静态类,那么无论在本类里或者在其余外部类,均可以直接使用静态变量名。
以下的Java程序
public class Test {命令行
public static void main(String[] args) { System.out.println(args[0]); }
}
若采用命令行“java Test one two three”调用,则程序输出的结果为:线程
正确答案: B 你的答案: A (错误)code
A Test
B one
C two
D java对象
Test是类名,one two three才是main方法的参数。
下面有关java的一些细节问题,描述错误的是?
正确答案: B 你的答案: A (错误)接口
A 构造方法不须要同步化
B 一个子类不能够覆盖掉父类的同步方法
C 定义在接口中的方法默认是public的
D 容器保存的是对象的引用three
构造方法每次都是构造出新的对象,不存在多个线程同时读写同一对象中的属性的问题,因此不须要同步 。 若是父类中的某个方法使用了 synchronized关键字,而子类中也覆盖了这个方法,默认状况下子类中的这个方法并非同步的,必须显示的在子类的这个方法中加上 synchronized关键字才可。固然,也能够在子类中调用父类中相应的方法,这样虽然子类中的方法并非同步的,但子类调用了父类中的同步方法,也就至关子类方法也同步了。 接口里面的变量为常量,其实际是 public static final ;接口里面的方法为抽象方法,其实际是public abstract
What is displayed when the following is executed;同步
正确答案: A 你的答案: 空 (错误) double d1=-0.5; System.out.println("Ceil d1="+Math.ceil(d1)); System.out.println("floor d1="+Math.floor(d1));
A
Ceil d1=-0.0
floor d1=-1.0it
B
Ceil d1=0.0
floor d1=-1.0
C
Ceil d1=-0.0
floor d1=-0.0
D
Ceil d1=0.0
floor d1=0.0
E
Ceil d1=0
floor d1=-1
ceil:大于等于 x,而且与它最接近的整数。 floor:小于等于 x,且与 x 最接近的整数。
这里主要是有一点: Math.ceil(d1) ceil 方法上有这么一段注释:If the argument value is less than zero but greater than -1.0, then the result is negative zero 若是参数小于0且大于-1.0,结果为 -0 Math.floor(d1) ceil 和 floor 方法 上都有一句话:If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument,意思为:若是参数是 NaN、无穷、正 0、负 0,那么结果与参数相同, 若是是 -0.0,那么其结果是 -0.0
变量a是一个64位有符号的整数,初始值用16进制表示为:0Xf000000000000000; 变量b是一个64位有符号的整数,初始值用16进制表示为:0x7FFFFFFFFFFFFFFF。 则a-b的结果用10进制表示为多少?()
正确答案: C 你的答案: 空 (错误)
A 1
B -(2^62+2^61+2^60+1)
C 2^62+2^61+2^60+1
D 2^59+(2^55+2^54+…+2^2+2^1+2^0)
0Xf000000000000000补码为1111000000000000000000000000000000000000000000000000000000000000 0x7FFFFFFFFFFFFFFF补码为0111111111111111111111111111111111111111111111111111111111111111 a-b=a+(-b)= 1111000000000000000000000000000000000000000000000000000000000000+ 1000000000000000000000000000000000000000000000000000000000000001= 10111000000000000000000000000000000000000000000000000000000000001(高位溢出舍去) 则结果为 0111000000000000000000000000000000000000000000000000000000000001= 2^62+2^61+2^60+1 答案为C
0x7FFFFFFFFFFFFFFF+1=0X8000000000000000,那么 a-b=0Xf000000000000000-0X8000000000000000+1 =0X7000000000000001 =16^15*7+16^0*1 =2^60*7+1 =2^60*(2^2+2^1+2^0)+1 =2^62+2^61+2^60+1