java技术面试题
判断下列是否有错,并说出错因:
1.
abstract class SomeThing{
private final String str;
protected static void doSomeThing(){};
}
2.
class SomeThing{
public void doSomeThing(){
final String str = "";
int len = str.lenght();
}
}
3.
class SomeThing{
public int doSomeThing(final int i){
return i++;
}
}
4.
class SomeThing{
final String str = "";
public SomeThing(){
str = "abcd";
}
}
5.
class SomeThing{
final String str;
public SomeThing(){
str = "abcd";
}
}
判断输出结果:
class SomeThing{
public static void main(String args []){
StringBuffer A = new StringBuffer("A");
StringBuffer B = new StringBuffer("B");
String a = "ab";
String b = "c";
operate(A,B);
operate(a,b);
System.out.println(A+","+B);
System.out.println(a+","+b);
}
private static void operate(StringBuffer x,StringBuffer y){
x.append(y);
y=x;
}
private static void operate(String x,String y){
x+=y;
y=x;
}
}
编程题:
给出中文数值,输出对应的数字
例:给出"一万零一十"转换成"10010"输出
条件:
1.最大数值不会超过亿级
2.中文数值包括:亿,万,千,百,十