摘要: 1 private String input;2 private BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));3 input = buffer.readLine(); 阅读全文
posted @ 2013-12-07 20:22 soul390 阅读(103) 评论(0) 推荐(0) 编辑
摘要: java中判断字符串是否为数字的三种方法1.用JAVA自带的函数publicstaticbooleanisNumeric(Stringstr){for(inti=str.length();--i>=0;){if(!Character.isDigit(str.charAt(i))){returnfalse;}}returntrue;}2.用正则表达式public static boolean isNumeric(String str){ Pattern pattern = Pattern.compile("[0-9]*"); return pattern.matcher 阅读全文
posted @ 2013-12-07 16:14 soul390 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 1 import java.io.BufferedReader; 2 import java.io.InputStreamReader; 3 import java.io.PrintWriter; 4 import java.net.ServerSocket; 5 import java.net.Socket; 6 7 8 public class Server { 9 public static void main(String[] args) {10 ServerSocket serverSocket = null;11 Socket sock... 阅读全文
posted @ 2013-12-07 08:57 soul390 阅读(162) 评论(0) 推荐(0) 编辑