设为首页 加入收藏

TOP

外企Java笔试题
2014-11-10 10:15:05 来源: 作者: 【 】 浏览:28
Tags:外企 Java 试题

1Which of the following fragments might cause errors (5%)
  A. String s = “Gone with the wind”;
  String t = ” good “;
  String k = s + t;


  B. String s = “Gone with the wind”;
  String t;
  t = s[3] + “one”;


C. String s = “Gone with the wind”;
  String standard = s.toUpperCase();


  D. String s = “home directory”;
  String t = s – “directory”;


2 public class Parent { (5%)
  public int addValue( int a, int b) {
  int s;
  s = a+b;
  return s;
  }
  }
  class Child extends Parent {


  }
  Which methods can be added into class Child
  A. int addValue( int a, int b ){// do something…}
  B. public void addValue (){// do something…}
  C. public int addValue( int a ){// do something…}
  D. public int addValue( int a, int b )throws MyException {//do something…}


3 Given: (5%)
Exhibit:
public class test {
public static void stringReplace (String text) {
text = text.replace (‘j’ , ‘i’);
}


public static void bufferReplace (StringBuffer text) {
text = text.append (“C”);
}


public static void main (String args[]} {
String textString = new String (“java”);
StringBuffer text BufferString = new StringBuffer (“java”);
stringReplace (textString);
bufferReplace (textBuffer);
System.out.printIn (textString + textBuffer);
}
}
What is the output


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇应聘上海中兴的要点 下一篇作为网站管理者应当如何防范XSS?

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: