weimaomin/
共12个网摘 [
1 ] |
访问weimaomin的个人空间
weimaomin收录,使用标签:java,时间:2006-11-5 17:21:56 | 相关网摘,我也收藏
题目:要求从键盘输入一数字,然后中文输出(要符合中文语法)
例:12434 输出 一万二千四百三十四
String num = "零壹贰叁肆伍陆柒捌玖";
String dw = "圆拾佰仟万亿";
String m = "30020.23";
String mm[] = null;
mm = m.split("\\.");
String money = mm[0];
String result = num.charAt(Integer.parseInt("" + mm[1].charAt(0))) + "角" +
num.charAt(Integer.parseInt("" + mm[1].charAt(1))) + "分";
for (int i = 0; i < money.length(); i++) {
String str = "";
int n = Integer.parseInt(money.substring(money.length() - i - 1,
money.length() - i));
str = str + num.charAt(n);
if (i == 0) {
str = str + dw.charAt(i);
}
else if ( (i + 4) % 8 == 0) {
str = str + dw.charAt(4);
}
else if (i % 8 == 0) {
str = str + dw.charAt(5);
}
else {
str = str + dw.charAt(i % 4);
}
result = str + result;
}
result = result.replaceAll("零([^圆]{1})", "零");
result = result.replaceAll("零+", "零");
result = result.replaceAll("零圆", "圆");
System.out.println(result);
http://community.csdn.net/Expert/topicview.asp?id=5093849
weimaomin收录,使用标签:java,时间:2006-11-3 22:57:47 | 相关网摘,我也收藏
/**
* 验证Email格式是否正确
* @param email 一个email字符串参数
* @return 如果email格式正确则返回true,否则返回false
*/
public boolean checkEmail(String email){
boolean flag=false;
Pattern p=Pattern.compile("^[a-zA-Z0-9_]+@\\w+\\.[a-zA-Z]+(\\.[a-zA-Z]+)*$");
Matcher m = null;
m = p.matcher(email);
flag = m.matches();
return flag;
}
http://community.csdn.net/Expert/topicview.asp?id=5132125
weimaomin收录,使用标签:java,时间:2006-11-1 12:21:53 | 相关网摘,我也收藏
几道面试题求解 大家说完答案后说说为什么阿
面试例题1:以下创建了几个对象______。
String A,B,C
A = "a";
B = "b";
A = A + B;
StringBuffer D = new StringBuffer("abc");
D = D.append("567");
A 4 B 3 C 5 D 6
2以下程序错误的是______
A. short s=1;s=s+1;
B. short s=1;s+=1;
3哪个方法不改变线程的状态______
A start() B run() C isAlive() D sleep()
4如何实现java的序列化______(这道题没看懂)
A .page B request C session D application
5在Java程序的异常处理中,总是表示执行的语句是______
A final B finally C finalize D都不是
6List.Map.Set等接口中,不能包含重复元素的接口是______
A List B Map C Set D都不是
7 以下______断代马不会被执行
try{
code1......
Return;
code2......
}catch(Exception e)
{
code3
}
finally
{
code4
}
A code1 B code2 C code3 D code4
http://community.csdn.net/Expert/topicview.asp?id=5122956
weimaomin收录,使用标签:java,时间:2006-10-31 19:54:12 | 相关网摘,我也收藏
1. public class test(
2. public static void main(string[]args){
3. string foo = args [1];
4. string foo = args [2];
5. string foo = args [3];
6. }
7. )
And command line invocation:
Java Test red green blue
What is the result?
A. Baz has the value of “”
B. Baz has the value of null
C. Baz has the value of “red”
D. Baz has the value of “blue”
F. The code does not compile.
G. The program throws an exception.
http://community.csdn.net/Expert/topicview.asp?id=5122513
共12个网摘 [
1 ]