• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
archur_code
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

随笔分类 -  JAVA

 
java UDP通信
摘要:服务器端:public class UDPServer{public static void main(String[] args) throws Exception{byte buf[] = new byte[1024];DatagramPacket dp = new DatagramPacket... 阅读全文
posted @ 2014-09-27 22:31 archur_code 阅读(235) 评论(0) 推荐(0)
java TCP通信
摘要:服务器端:public class TCPServer{ public static void main(String[]args){ ServerSocket ss = new ServerSocket(6666); while(true){ Socket s = ss.a... 阅读全文
posted @ 2014-09-27 22:27 archur_code 阅读(184) 评论(0) 推荐(0)
java 线程sleep方法
摘要:public static void main(String[] args) {Runner1 r1 = new Runner1();Thread t = new Thread(r1);t.start();try {Thread.sleep(10000);} catch (InterruptedEx... 阅读全文
posted @ 2014-09-25 19:09 archur_code 阅读(153) 评论(0) 推荐(0)
java 线程1
摘要:public static void main(String[] args) {Runner1 r1 = new Runner1();Thread t = new Thread(r1);t.start();for (int i = 0; i "+i);}}//Runner1实现Runable接口cl... 阅读全文
posted @ 2014-09-25 17:19 archur_code 阅读(155) 评论(0) 推荐(0)
Java TestMap
摘要:private static final Integer ONE = new Integer(1);public static void main(String[] args) {Map m = new HashMap();for (int i = 0; i < args.length; i++) ... 阅读全文
posted @ 2014-09-23 21:26 archur_code 阅读(117) 评论(0) 推荐(0)
Java TestDataStream
摘要:public static void main(String[] args) throws IOException {ByteArrayOutputStream baos = new ByteArrayOutputStream();DataOutputStream dos = new DataOut... 阅读全文
posted @ 2014-09-23 21:25 archur_code 阅读(154) 评论(0) 推荐(0)
Java TestTransform
摘要:public static void main(String[] args) throws IOException {InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedR... 阅读全文
posted @ 2014-09-23 21:24 archur_code 阅读(113) 评论(0) 推荐(0)
java FileReaderWriter
摘要:public static void main(String[] args) throws IOException {FileReader fr = new FileReader("C:/Users/宇超/Desktop/hello.txt");FileWriter fw = new FileWri... 阅读全文
posted @ 2014-09-23 21:23 archur_code 阅读(104) 评论(0) 推荐(0)
Java TestBufferRW
摘要:public static void main(String[] args) throws IOException {BufferedWriter bw = new BufferedWriter(new FileWriter("C:/Users/宇超/Desktop/rand.txt"));Buff... 阅读全文
posted @ 2014-09-23 21:22 archur_code 阅读(105) 评论(0) 推荐(0)
Java TestInputStream
摘要:public static void main(String[] args) throws IOException {FileInputStream in = null;FileOutputStream out = null;int b=0;in = new FileInputStream("C:\... 阅读全文
posted @ 2014-09-23 21:21 archur_code 阅读(163) 评论(0) 推荐(0)
Java实例对象间的比较(实现Comparable接口)
摘要:intcompareTo(To)Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is le... 阅读全文
posted @ 2014-09-22 20:15 archur_code 阅读(278) 评论(0) 推荐(0)
java 枚举
摘要:public enum Mycolor{red,green,blue};//定义一种新类型 阅读全文
posted @ 2014-09-20 20:41 archur_code 阅读(86) 评论(0) 推荐(0)
递归列出文件树
摘要:private static void tree(File f,int level){String preStr = "";for (int i = 0; i < level; i++) {preStr+=" ";}File [] childs = f.listFiles();for (int i ... 阅读全文
posted @ 2014-09-20 16:42 archur_code 阅读(87) 评论(0) 推荐(0)
文件操作(创建和写)
摘要:String separator = File.separator;String filename = "myfile.txt";String dir = "mydir1"+separator+"mydir2";File f = new File(dir,filename);if(f.exists... 阅读全文
posted @ 2014-09-20 16:33 archur_code 阅读(160) 评论(0) 推荐(0)
将给定字符串转换成double型数组
摘要:public static void main(String[] args) {String str = "1,2,3;4,5;6,7,8,9";String[] s1 = str.split(";");double [][]d;d = new double[s1.length][];for (in... 阅读全文
posted @ 2014-09-20 16:10 archur_code 阅读(1858) 评论(0) 推荐(0)
StringBuffer 的使用
摘要:java.lang.StringBuffer可变的字符串String之间的连接是通过开辟一块新的内存 让后将它们拷贝进来StringBuffer则可以直接在后面追加方法: append(charc) delete(intstart, intend) insert(intoffset... 阅读全文
posted @ 2014-09-20 15:26 archur_code 阅读(131) 评论(0) 推荐(0)
String subString方法
摘要:package 字符串2;public class TestString {public static void main(String[] args) { String str = "Returns a new character sequence that is a subsequence of... 阅读全文
posted @ 2014-09-20 14:52 archur_code 阅读(126) 评论(0) 推荐(0)
String 学习1(split valueof)
摘要:Strings are constant; their values cannot be changed after they are created String s1 = "Hello";String s2 = "Hello";System.out.println(s1==s2); //true... 阅读全文
posted @ 2014-09-20 14:27 archur_code 阅读(150) 评论(0) 推荐(0)
 

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3