java题库10

1.

      可变参数的使用规则:

     1.最后一个参数,前不能由非可变参数

        2.如果有同名的非可变参数函数,优先匹配

        3.如果有两个可以匹配的可变参数函数,错误

2.

static final int[] a = { 100,200 };
B.static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }
C.static final int[] a = new int[2]{ 100,200 };
D.static final int[] a; 
static void init() { a = new int[3]; a[0]=100; a[1]=200; }

只有A B合法

3.

       同名变量就近原则

4.

  run()方法:在本线程内调用该Runnable对象的run()方法,可以重复多次调用;
start()方法:启动一个线程,调用该Runnable对象的run()方法,不能多次启动一个线程;

5.

short 和Short是不同的

6.

Locale.setDefault(new Locale("fr", "FRANCE", "MAC"));The method setLocale(Locale) is undefined for the type DateFormat

7.

Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object? (Choosetwo.)
A. When using versions of Java technology earlier than 5.0.
B. When sharing a StringBuffer among multiple threads.
C. When using the java.io class StringBufferInputStream.
D. When you plan to reuse the StringBuffer to build more than one string.
Answer: AB
Section: All
 

8.

Console中readpassword返回的是char[]而不是string

9.

\s必须使用转义\

10.

全局变量: return(i++);   <==>  return i ; i=i+1;
局部变量: return(i++);   <==>  return i ; //应该没有i=i+1这个动作发生了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值