【单选题】【消耗次数:1】
关于以下程序代码的说明正确的是( ) 1.class HasStatic{ 2. private static int x=100; 3. public static void main(String args[ ]){ 4. HasStatic hs1=new HasStatic( ); 5. hs1.x++; 6. HasStatic hs2=new HasStatic( ); 7. hs2.x++; 8. hs1=new HasStatic( ); 9. hs1.x++; 10. HasStati@@x- -; 11. System.out.println(“x=”+x); 12. } 13. }
5行不能通过编译,因为引用了私有静态变量
10行不能通过编译,因为x是私有静态变量
程序通过编译,输出结果为:x=103
程序通过编译,输出结果为:x=102
参考答案:
复制
纠错
相关题目
【单选题】 关于以下application的说明,正确的是( ) 1. class StaticStuff 2. { 3. static int x=10; 4. static { x+=5;} 5. public static void main(String args[ ]) 6. { 7. System.out.println(“x=” + x); 8. } 9. static { x/=3;} 10. }
①  4行与9行不能通过编译,因为缺少方法名和返回类型
②  9行不能通过编译,因为只能有一个静态初始化器
③  编译通过,执行结果为:x=5
④  编译通过,执行结果为:x=3
【单选题】 下列程序的运行结果是( ) 。 public class X5_1_2 extends x{ int ab() { static int aa=10; aa++; System.out.println(aa); } public static void main(String[] args) { X5_1_2 x=new X5_1_2(); x.ab(); } }
①  10
②  11
③  编译错误
④  运行成功,但不输出
【单选题】 编译运行以下程序后,关于输出结果的说明正确的是 ( ) public class Conditional{ public static void main(String args[ ]){ int x=4; System.out.println(“value is “+ ((x>4) ? 9.9:9)); } }
①  输出结果为:value is 99.9
②  输出结果为:value is 9
③  输出结果为:value is 9.0
④  编译错误
【单选题】 已知有下面类的说明: public class X5_1_1 extends x{ private float f =10.6f; int i=16; static int si=10; public static void main(String[] args) { X5_1_1 x=new } } X5_1_1(); 在 main()方法中,下面哪条语句的用法是正确的?( )
①  x.f
②  this.si
③  X5_1_1.i
④  X5_1_1.f
【单选题】 下面代码运行后的输出结果为( ) 。 public class X6_1_5 { public static void main(String[] args) { AB aa = new AB(); AB bb; bb = aa; System.out.println(b@@equals(aa)); } } class AB{ int x = 100; }
①  true
②  false
③  编译错误
④  100
【单选题】 下列程序执行的结果是( ) 。 public class X7_1_6 { public static void main(String[] args) { try{ return; } finally{ System.out.println(Finally); } } }
①  程序正常运行,但不输出任何结果
②  程序正常运行,并输出 Finally
③  编译通过,但运行时出现异常
④  因为没有 catch 子句,因此不能通过编译
【单选题】 运行下面程序时,会产生什么异常?( ) public class X7_1_5 { public static void main(String[] args) { int[] z = { 1,2,3,4 } ; int p = z[4]; int x = 0; int y = 5/x; } }
①  ArithmeticException
②  NumberFormatException
③  ArrayIndexOutOfBoundsException
④  IOException
【单选题】 运行下面程序时,会产生什么异常?( ) public class X7_1_4 { public static void main(String[] args) { int x = 0; int y = 5/x; int[] z = { 1,2,3,4 } ; int p = z[4]; } }
①  ArithmeticException
②  NumberFormatException
③  ArrayIndexOutOfBoundsException
④  IOException
【单选题】 以下程序段运行后,x[1]的值为()。intx[5]={5,4,3,2,1};x[1]=x[3]+x[2+2]-x[3-1];
①  6
②  0
③  1
④  5
【单选题】 以下程序的输出的结果是()。 int x=3; main( ) int i; for(i=1;i<x;i++)incre( );incre( ) staic int x=1; x*=x+1; printf( %d, x);
①  25
②  26
③  27
④  28
随机题目
【单选题】 If he_____the storekeepers scissors,he would have forgotten to buy a pair.
①  would not see
②  had not seen
③  having not seen
④  has not seen
【单选题】 It was not until she had finished all her work_____.
①  did she return
②  that she returned
③  when she returned
④  that did she return
【单选题】 Being extremely_____to the cold,I do not like skating.
①  sensitive
②  senseless
③  insensitive
④  sensible
【单选题】 I dont feel like_____anything now.
①  to eat
②  eating
③  having eaten
④  to be eating
【单选题】 ( )的情感理论认为个体根据经验和情景线索对生理唤起加以解释,由此产生特定情绪。
①  威廉·詹姆斯
②  沃特·坎农
③  卡尔·兰格
④  沙赫特
【单选题】 利用音乐.幽默,引起快感的视觉刺激等营销方法,这是根据( )
①  刺激的突出性
②  刺激的熟悉感
③  消费者专业性
④  消费者情绪
【多选题】 消费者的能力差异主要表现在
①  能力水平
②  能力类型
③  能力表现时间
④  能力的自我感知
【判断题】 动机与消费行为之间是一一对应的关系
①  正确
②  错误
【单选题】 1899年, 诞生,成为世界上第一个全国性 的消费者组织。
①  美国消费者联盟
②  英国消费者联盟
③  法国消费者联盟
④  日本消费者联盟
【单选题】 根据( )群体的互动作用和接触率可分为主要群体和次要群体
①  拒绝
②  热望
③  会员
④  回避