JavaÖмÆÊ±Æ÷µÄʹÓÃ
import java.util.Timer;
import java.util.TimerTask;
public class TimerExample
{
/**
* JavaÖмÆÊ±Æ÷µÄʹÓÃ
* Time: 21:19 2010-1-5
*/
Timer localTimer;
public TimerExample(int seconds)
{
// Create local timer
localTimer = new Timer();
// Create local timer task and set the timer-parameter
localTimer.schedule(new LocalTimerTask(), 0, seconds * 1000);
}
class LocalTimerTask extends TimerTask
{
int bitTest = 0xFFFFFFFF;
int flag = 1;
int temp = bitTest;
// Override the abstract method of TimerTask
// The run() will be called every per timer
public void run()
{
if (temp < 0)
{
System.out.println(Integer.toBinaryString(temp));
temp = bitTest & (~flag);
flag <<= 1;
}
Ïà¹ØÎĵµ£º
File.separatorChar ·µ»ØÒ»¸ö×Ö·û£¬±íʾµ±Ç°ÏµÍ³Ä¬ÈϵÄÎļþÃû·Ö¸ô·û£¬ÔÚWindowsÖÐΪ"\",unixÖÐΪ"/"¡£
File.separator ÓëǰÕßÏàͬ£¬µ«½«·Ö¸ô·û×÷Ϊ×Ö·û´®ÀàÐÍ·µ»Ø¡£
pathSeparatorChar ·µ»ØÒ»¸ö×Ö·û£¬±íʾµ±Ç°ÏµÍ³Ä¬ÈϵÄ·¾¶Ãû·Ö¸ô·û£¬ÔÚWindowsÖÐΪ";",unixÖÐΪ":"¡£
File.pathSeparator ÓëǰÕßÏàͬ£¬µ«½«·Ö¸ô·û×÷Ϊ×Ö· ......
import java.net.InetAddress;
//±¾³ÌÐòʵÏÖÁË»ñÈ¡±¾µØIPµØÖ·
public class IP {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
InetAddress localHost;
InetAddress []ip;
try{
localHost=InetAddress.getLocalHost();
ip=InetAddr ......
1¡¢ÈçºÎ½«×Ö·û´®Stringת»¯ÎªÕûÊýint
int i = Integer.parseInt(str);
int i = Integer.valueOf(my_str).intValue();
×¢: ×Ö´®×ª³ÉDouble, Float, LongµÄ·½·¨´óͬСÒì¡£
2¡¢ÈçºÎ½«×Ö·û´®Stringת»¯ÎªInteger
Integer integer=Integer.valueOf(i)
3¡¢ÈçºÎ½«ÕûÊý ......
¸ñʽ»¯Êä³öÊý×Ö
·Ò룺Cherami
email:cherami@163.net
ÔÎÄ£ºhttp://developer.java.sun.com/developer/TechTips/2000/tt0411.html
ÓÐʱÎÒÃÇÐèÒª¿ØÖÆÊä³öµÄÊý×ֵĸñʽ£¬ÈçºÎʹÓÃjavaµÄÀà¿â×öµ½Õâ¸öÄØ£¿
Ò²ÐíÄã²»¹ØÐĸñʽ£¬µ«ÊÇÄãÐèÒª¹ØÐÄÄãµÄ³ÌÐò¿ÉÒÔÔÚÈ«ÊÀ½çͨÓã¬Ï ......
Ò»¹²ÓÐÈý¸öÀࣺWriteFile ; ReadFile ; InsertDB ;
//WriteFile.java
//ÓÃÓÚ½«ÐÅϢдÈëÎı¾Îļþ
package org.mb.insertfromfile;
import java.io.*;
public class WriteFile{
private int count = 0 ;
public int getCount() {
return count;
}
public void setCount(int count) {
this.cou ......