Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java socketͨÐÅ TCP UDP

 java socketͨÐÅ
TCP¿Í»§¶Ë£º
import java.net.*;
import java.io.*;
public class Client {
static Socket server;
public static void main(String[] args) throws Exception {
server = new Socket(InetAddress.getLocalHost(), 23);
BufferedReader in = new BufferedReader(new InputStreamReader(server
.getInputStream()));
PrintWriter out = new PrintWriter(server.getOutputStream());
BufferedReader wt = new BufferedReader(new InputStreamReader(System.in));
while (true) {
System.out.println("ÏëÖªµÀÏÖÔÚÊÇʲôʱ¼äÂð£¿(ÊäÈëÈÎÒâÎÄ×Ö±íʾ ͬÒ⣬ÊäÈëend±íʾÍ˳ö)");
String str = wt.readLine();
out.println(str);
out.flush();
if (str.equals("end")) {
break;
}
System.out.println(in.readLine());
}
server.close();
}
}

TCP·þÎñÆ÷´úÂ룺
import java.io.*;
import java.net.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class Server {
public static void main(String[] args) throws IOException {
ServerSocket server = new ServerSocket(23);
Socket client = server.accept();
BufferedReader in = new BufferedReader(new InputStreamReader(client
.getInputStream()));
PrintWriter out = new PrintWriter(client.getOutputStream());
while (true) {
String str = in.readLine();
System.out.println(str);

SimpleDateFormat f=new SimpleDateFormat("MMM dd,yyyy kk:mm:ss");
String time = f.format(new Date());

out.println("ÏÖÔÚµÄʱ¼äÊÇ£º"+time);
out.flush();
if (str.equals("end"))
break;
}
client.close();
}
}

UDP·þÎñÆ÷´úÂ룺
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.ServerSocket;
import java.net.SocketException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class UDPServer {
private static DatagramSocket udpSocket = null;
private static DatagramPacket packet = null;
public UDPServer() throws SocketE


Ïà¹ØÎĵµ£º

³õʶIReport2¡¢JasperReport£¨javaÓ¦Óã©

 ±¨±íµÄÉúÃüÖÜÆÚºÍjavaÀàµÄ·Ç³£ÏàËÆ£¬java±»Ò»Ð©Ô´Îļþ×é³É£¬ÕâЩԴÎļþ±»±àÒë³ÉÀ©Õ¹ÃûΪclassµÄÎļþ¡£Í¬ÑùµÄÒ»¸ö±¨±íÒ²ÊÇiyouÒ»¸öÔ´´úÂëµÄÎʼÛÄêÀ´ÃèÊöµÄ£¬Ô´ÎļþµÄÀ©Õ¹ÃûΪ . jrxml £¬È»ºó±»±àÒë³É .jasperÎļþ.
JasperReport ÊÇÒ»¸öjar¿â£¬ËûÌṩÒÔÏÂÖ÷ÒªÀࣺ
net.sf.jasperreports.engine.JasperCompileMan ......

java¶àÏ̱߳à³ÌÌå»á

ÔÚ Java ³ÌÐòÖÐʹÓöàÏß³ÌÒª±ÈÔÚ C »ò C++ ÖÐÈÝÒ׵ö࣬ÕâÊÇÒòΪ Java ±à³ÌÓïÑÔÌṩÁËÓïÑÔ¼¶µÄÖ§³Ö¡£±¾ÎÄͨ¹ý¼òµ¥µÄ±à³ÌʾÀýÀ´ËµÃ÷ Java ³ÌÐòÖеĶàÏß³ÌÊǶàôֱ¹Û¡£¶ÁÍê±¾ÎÄÒÔºó£¬Óû§Ó¦¸ÃÄܹ»±àд¼òµ¥µÄ¶àÏ̳߳ÌÐò¡£
¡¡¡¡ÎªÊ²Ã´»áÅŶӵȴý£¿
¡¡¡¡ÏÂÃæµÄÕâ¸ö¼òµ¥µÄ Java ³ÌÐòÍê³ÉËÄÏî²»Ïà¹ØµÄÈÎÎñ¡£ÕâÑùµÄ³ÌÐòÓе¥¸ö¿ØÖ ......

javaÕýÔò±í´ïʽ

package com.yzy;
import java.util.regex.*;
public class Test {
 /**
  * @param args
  */
 public static void main(String[] args) {
  Pattern p=Pattern.compile("^[a-z]+");
  Matcher m=p.matcher("a233"); //true
  //Matcher m=p.matcher("2233") ......

Java·´ÉäÖ®Methodµ÷ÓúÍFiledÉèÖÃ

·´ÉäÊÇjavaµÄÒ»¸ö¸ß¼¶ÌØÐÔ¡£
Reflection ÊÇJava±»ÊÓΪ¶¯Ì¬£¨»ò×¼¶¯Ì¬£©ÓïÑÔµÄÒ»¸ö¹Ø¼üÐÔÖÊ¡£Õâ¸ö»úÖÆÔÊÐí³ÌÐòÔÚÔËÐÐʱ͸¹ýReflection APIsÈ¡µÃÈκÎÒ»¸öÒÑÖªÃû³ÆµÄclassµÄÄÚ²¿ÐÅÏ¢£¬°üÀ¨Æämodifiers£¨ÖîÈçpublic, static µÈµÈ£©¡¢superclass£¨ÀýÈçObject£©¡¢ÊµÏÖÖ®interfaces£¨ÀýÈçSerializable£©£¬Ò²°üÀ¨fieldsºÍmethods µ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ