Java常见面试题(一)

1 实现一个 字符串的 reverse函数和 replace函数.
reverse:

public static void stringReverser() {
String strOld = “aaabbb”;
String strNew = new StringBuffer(a).reverse().toString();
System.out.println(strNew);
}

replace:

public static String replace(String text, String repl, String with) {
if ((text == null) || (repl == null) || (with == null)
|| (repl.length() == 0) || (max == 0)) {
return text;
}

StringBuffer buf = [...]

Posted in java学习 | Tags:

Get Adobe Flash playerPlugin by wpburn.com wordpress themes