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

javaÎÞÊý¾ÝÔ´Á¬½ÓAccessÊý¾Ý¿âʵÀý

  1.Á¬½ÓÊý¾Ý¿âConnDB()Àà
package tool;
/****************************
**
**ÊôÐÔÎļþÓëÊý¾Ý¿â¾ùÔÚtool°üÏÂÃæ
**
*****************************/
/* Êý¾Ý·ÃÎÊ×é¼þ */
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
public class ConnDB{
private static ConnDB instance=null;
String db_driver=null;
String db_url=null;
String db_user=null;
String db_psw=null;
String db_name=null;
String proPath="conn.properties";
Connection conn=null;
public ConnDB(){
InputStream in=getClass().getResourceAsStream(proPath);
Properties prop=new Properties();
try {
prop.load(in);
db_driver=prop.getProperty("db_driver",db_driver);
db_url=prop.getProperty("db_url",db_url);
db_user=prop.getProperty("db_user",db_user);
db_psw=prop.getProperty("db_psw", db_psw);
db_name=prop.getProperty("db_name",db_name);

db_url=db_url+getDBPath();
} catch (IOException e) {
e.printStackTrace();
}
}
//»ñµÃ°²È«Á¬½Ó
public synchronized Connection getConnection(){
if(instance==null){
instance=new ConnDB();
}
return instance._getConnection();
}
//ÊÍ·Å×ÊÔ´
public static void dbClose(Connection conn,PreparedStatement ps,ResultSet rs){
try{
if(rs!=null){
rs.close();
}
if(ps!=null){
ps.close();
}
if(conn!=null){
conn.close();
}
}catch(SQLException e){
e.printStackTrace();
}
}
//´´½¨Á¬½Ó
private Connection _getConnection() {
try {
Class.forName(db_driver).newInstance();
conn=DriverManager.getConnection(db_url, db_user, db_psw);
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}
//·µ»ØÊý¾Ý¿âµÄ¾ø¶Ô·¾¶
public String getDBPath(){
String dbpath=getClass().getResource(db_name).getFile();
dbpath=db


Ïà¹ØÎĵµ£º

Java ÄÚ²¿Àà

¶¨ÒåÔÚÒ»¸öÀàÄÚ²¿µÄÀà½ÐÄÚ²¿À࣬°üº¬ÄÚ²¿ÀàµÄÀà³ÆΪÍⲿÀà¡£
ÄÚ²¿Àà¿ÉÒÔÉùÃ÷public¡¢protected¡¢privateµÈ·ÃÎÊÏÞÖÆ£¬
¿ÉÒÔÉùÃ÷ΪabstractµÄ¹©ÆäËûÄÚ²¿Àà»òÍⲿÀà¼Ì³ÐÓëÀ©Õ¹£¬
»òÕßÉùÃ÷Ϊstatic¡¢finalµÄ£¬Ò²¿ÉÒÔʵÏÖÌض¨µÄ½Ó¿Ú¡£
staticµÄÄÚ²¿ÀàÐÐΪÉÏÏóÒ»¸ö¶ÀÁ¢µÄÀ࣬
·ÇstaticÔÚÐÐΪÉÏÀàËÆÀàµÄÊôÐÔ»ò·½·¨ÇÒ½ûÖ¹ÉùÃ÷s ......

javaµ÷ÓÃexe»òÕßbatÎļþ

 import java.io.*;
public class TestExe {
    public static void main(String[] args) throws InterruptedException {
 try {
   Process child = Runtime.getRuntime().exec("C://Program Files//Sunyard//ImageInput//ImageInput.exe");
   child.waitFor();
&n ......

JavaÖÐÔõÑùÅжÏÒ»¸ö×Ö·û´®ÊÇ·ñÊÇÊý×Ö???

 ÔÚ±à³ÌµÄʱºò£¬¾­³£Óöµ½ÒªÅжÏÒ»¸ö×Ö·û´®ÖеÄ×Ö·ûÊÇ·ñÊÇÊý×Ö(0-9)
 ÏÂÃæÎÒ¸ø´ó¼Ò½éÉܼ¸ÖÖʵÏÖ·½·¨
1.ʹÓÃCharacter.isDigit(char)ÅжÏ
String str = "123abc";
if (!"".equals(str)) {
char num[] = str.toCharArray();//°Ñ×Ö·û´®×ª»»Îª×Ö·ûÊý×é
StringBuffer title = new StringBuffer();//ʹÓÃS ......

Java СÀý×Ó£ºÏß³Ìͬ²½Àý×Ó£ºÈý¸öѧÉúÈ¡Ë®

Èý¸öѧÉúµ½Ò»¸öË®ÁúÍ·ÏÂÅŶÓÈ¡Ë®£¬ÈýÈ˶¼È¡ÍêË®ºóÒ»ÆðÀ뿪¡£
ÕâÀïÉæ¼°µ½ÈçºÎÅжÏÈý¸öÈ˶¼È¡ÍêË®¡£Èç¹ûÓÃÆÕͨµÄ¾²Ì¬³ÉÔ±£¬ÊƱػáÒªÓÃÎÞÏÞÑ­»·À´µÈ´ý¡£¸üºÃµÄ°ì·¨ÊÇÓà wait-notify »úÖÆ¡£Ç°Á½¸öѧÉúÈ¡ÍêË®ºó¶¼ wait£¬×îºóÒ»¸öѧÉúÈ¡ÍêË®ºó notify£¬ÕâÑù¾ÍÄÜÒ»ÆðÀ뿪ÁË¡£ÏÂÃæÊÇ´úÂëʾÀý£º
/**
* Èý¸öѧÉúÅŶÓÈ¡Ë®£¬È¡ÍêºóÒ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ