正文

java面试笔试题大汇总(7)2005-12-27 21:19:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/ddtme/8929.html

分享到:

JAVA编程题1.现在输入n个数字,以逗号,分开;然后可选择升或者降序排序;按提交键就在另一页面显示按什么排序,结果为,提供resetimport java.util.*;public class bycomma{ public static String[] splitStringByComma(String source){   if(source==null||source.trim().equals(""))    return null;   StringTokenizer commaToker = new StringTokenizer(source,",");   String[] result = new String[commaToker.countTokens()];   int i=0;   while(commaToker.hasMoreTokens()){    result[i] = commaToker.nextToken();    i++;   }   return result; } public static void main(String args[]){ String[] s = splitStringByComma("5,8,7,4,3,9,1"); int[] ii = new int[s.length]; for(int i = 0;i

阅读(14436) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册