- 博客(14)
- 收藏
- 关注
原创 ToyProgram UDP server and client with IOStream
import java.io.*;import java.net.*;public class TestUdpServerlong2array { public static void main(String[] args) { try{ DatagramSocket dtskt = new DatagramSocket(8888); byte[] buffer = ne
2016-05-31 14:07:10 283
原创 Java网络编程进阶版
服务器端:import java.net.*;import java.io.*;public class TestSend_OutServer { public static void main(String[] args) { try{ ServerSocket sSocket = new ServerSocket(8888); while(true)
2016-05-23 20:15:01 602
原创 Java网络编程入门
服务器端:import java.io.*;import java.net.*;public class TestTcpServer { public static void main(String[] args) { try{ ServerSocket serS = new ServerSocket(6666); while(true){ Socket s
2016-05-23 20:11:19 348
原创 Toy Program:线程 alive
public class TestThreadaLive { public static void main(String[] args) { SubThread sbt = new SubThread(); Thread tr = new Thread(sbt); tr.start(); for(int i = 0; i < 50; i++){ System.ou
2016-05-21 17:50:59 478
原创 Toy Program——线程同步。涉及wait(),notifyall(),runnable,toString
public class TestProducerConsumer { public static void main(String[] args) { SyncStack ss = new SyncStack(); Producer pd = new Producer(ss); Consumer cs = new Consumer(ss); new Thread(pd).st
2016-05-20 14:17:39 406
原创 Toy Program——线程的优先级Priority
public class TestThreadPriority { public static void main(String[] args) { Thread t1 = new Thread(new SubThread("Thread_1")); Thread t2 = new Thread(new SubThread("T_H_R_E_A_D_-_-_2")); t1.set
2016-05-10 21:57:01 430
原创 通过Interface的Runnable实现多线程的Yield,含setName,getName
public class TestThreadYield { public static void main(String[] args) { SubThread subThread_1 = new SubThread("subThread_1"); SubThread subThread_2 = new SubThread("subThread_2"); Thread th1 =
2016-05-10 21:09:04 702
原创 通过interface的Runnable实现线程合并(join),涉及setName,getName,sleep
public class TestThreadJoin { public static void main(String[] args) { SubThread sub = new SubThread("AllByMyself"); Thread hst = new Thread(sub); hst.start(); try{ hst.join(); }catc
2016-05-10 20:45:41 743
原创 线程玩具:打断(interrupted)
import java.util.*;public class TestInterrupt { public static void main(String[] args) { SubThread subt = new SubThread(); Thread thr = new Thread(subt); thr.start(); try{ Thread.slee
2016-05-09 01:26:33 948
原创 Toy Program 基础线程入门 via “extends Thread”
public class TestThreadviaClassThread { public static void main(String[] args) { SubThread sthr = new SubThread(); sthr.start(); for(int i = 0; i < 100; i++){ System.out.println("MainThre
2016-05-08 23:19:24 418
原创 java.io.*下的日志功能入门
import java.util.*;import java.io.*;public class TestPrintStream2log { public static void main(String[] args) { String str = null; BufferedReader br = new BufferedReader(new InputStreamReader(
2016-05-08 22:39:13 295
原创 在执行期间制定文件位置并读取。利用BufferedReader与FileReader
import java.io.*;public class TestPrintStreamToReadingFile { public static void showOut(String str, PrintStream pstr){ try{ BufferedReader br = new BufferedReader(new FileReader(str)); Stri
2016-05-08 16:16:33 388
原创 IO.Util中的log(日志)
import java.util.*;import java.io.*;public class TestPrintStream2log { public static void main(String[] args) { String str = null; BufferedReader br = new BufferedReader(new InputStreamReader(
2016-05-08 16:14:25 223
原创 对象序列化输出 Serializable
import java.io.*;class DataGroup implements Serializable{ transient int h = 31; int i = 44; double j = 17.15; int k = 91;}public class TestObjectIO { public static void main(String[] args) {
2016-05-08 16:11:05 473
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人