随笔分类 -  java

摘要:import java.util.Random;class t1{public static void main(String[] args){ Random random1 = new Random(); char a; String b=""; for(int j=0;j='0' && a='A' && a='a' && a<='z')) { // System.out.println(a); b=b+a; } if(b.length()==32) { 阅读全文
posted @ 2014-04-09 20:19 egai 阅读(2669) 评论(0) 推荐(0)
摘要:程序编译javac -encoding GBK -d . *.java程序运行java javatest.Main本地数据库导出C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -uroot -p root udp >2.sql;mysql -u r... 阅读全文
posted @ 2014-04-08 22:34 egai 阅读(223) 评论(0) 推荐(0)
摘要:import java.util.Timer;import java.text.SimpleDateFormat;import java.util.Date;import java.util.TimerTask;class MyTask extends TimerTask{ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public void run(){ System.out.println(sdf.format(new Date())); }}public class t1{ pu 阅读全文
posted @ 2014-04-03 15:09 egai 阅读(389) 评论(0) 推荐(0)
摘要:不要使用mysql的关键字,如key. 2014.4.131.获取最大值 String device_sql= "select max(id) id from user";2.创建一条数据String create_sql="insert into unit (user_id,device_id,i... 阅读全文
posted @ 2014-03-26 11:24 egai 阅读(230) 评论(0) 推荐(0)
摘要:如何设置、查看JAVA_HOME、classpath、path变量值1、启动CMD命令窗口2、set JAVA_HOME=x:\JDK_1.4.2 set PATH=%JAVA_HOME%\bin;%PATH% set CLASSPATH=.\;%JAVA_HOME%\lib\tools.jar3、查看他们的值 echo %JAVA_HOME% echo %PATH% echo %CLASSPATH% 阅读全文
posted @ 2014-03-23 11:08 egai 阅读(2167) 评论(0) 推荐(0)
摘要:package javatest;import java.sql.*; public class DBconn{ // 驱动程序名 final String driver = "com.mysql.jdbc.Driver"; // URL指向要访问的数据库名test final String url = "jdbc:mysql://127.0.0.1:3306/udp"; // MySQL配置时的用户名 final String user = "root"; // MySQL配置时的密码 final String password = 阅读全文
posted @ 2014-03-21 10:14 egai 阅读(385) 评论(0) 推荐(0)
摘要:import java.io.*;import java.net.*;import java.util.Scanner;public class client{ public static void main(String[] args) { work.link(); new MyworkWriter().start(); }}class work{ //是否在线 static boolean online=false; static Socket s1 =null; static BufferedReader in=null; static PrintWriter out=n... 阅读全文
posted @ 2014-03-13 23:46 egai 阅读(306) 评论(0) 推荐(0)
摘要:package testreadline;import java.net.*;import java.io.*;public class test { public static void main(String[] args) throws IOException { ServerSocket serversocket=new ServerSocket(80); while(true) { Socket socket=serversocket.accept(); new ServerThread(socket).start(); } }}class Ser... 阅读全文
posted @ 2014-03-13 23:37 egai 阅读(264) 评论(0) 推荐(0)
摘要:package testreadline;import java.net.*;import java.nio.ByteBuffer;import java.nio.channels.*;import java.nio.charset.*;import java.util.concurrent.*;import java.io.*;public class test { public static void main(String[] args) throws IOException { new SimpleHttpServer().service(); }} class SimpleHt... 阅读全文
posted @ 2014-03-13 22:52 egai 阅读(211) 评论(0) 推荐(0)