栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > Java面试题

外企Java笔试题

Java面试题 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

外企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?

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/359629.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号