javaÊý¾ÝÀàÐÍת»»
1ÈçºÎ½«×Ö´® String ת»»³ÉÕûÊý int?
A. ÓÐÁ½¸ö·½·¨:
1). int i = Integer.parseInt([String]); »ò
i = Integer.parseInt([String],[int radix]);
2). int i = Integer.valueOf(my_str).intValue();
×¢: ×Ö´®×ª³É Double, Float, Long µÄ·½·¨´óͬСÒì.
2 ÈçºÎ½«ÕûÊý int ת»»³É×Ö´® String ?
A. ÓÐÈþÖÖ·½·¨:
1.) String s = String.valueOf(i);
2.) String s = Integer.toString(i);
3.) String s = "" + i;
×¢: Double, Float, Long ת³É×Ö´®µÄ·½·¨´óͬСÒì.
JAVAÊý¾ÝÀàÐÍת»»
¹Ø¼ü×Ö ÀàÐÍת»»
³ö´¦
ÕâÊÇÒ»¸öÀý×Ó,˵µÄÊÇJAVAÖÐÊý¾ÝÊýÐ͵Äת»».¹©´ó¼ÒѧϰÒý
package cn.com.lwkj.erts.register;
import java.sql.Date;
public class TypeChange {
public TypeChange() {
}
//change the string type to the int type
public static int stringToInt(String intstr)
{
Integer integer;
integer = Integer.valueOf(intstr);
return integer.intValue();
}
//change int type to the string type
public static String intToString(int value)
{
Integer integer = new Integer(value);
return integer.toString();
}
//change the string type to the float type
public static float stringToFloat(String floatstr)
{
Float floatee;
floatee = Float.valueOf(floatstr);
return floatee.floatValue();
}
//change the float type to the string type
public static String floatToString(float value)
{
Float floatee = new Float(value);
return floatee.toString();
}
//change the string type to the sqlDate type
public static java.sql.Date stringToDate(String dateStr)
{
return java.sq
Ïà¹ØÎĵµ£º
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔǰ£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
1¡¢½«ÏîÄ¿´ò°üºÃ£»
2¡¢½«JREĿѹËõ³ÉJRE.rar,·ÅÔÚµ±Ç°ÏîĿĿ¼Ï£»
2¡¢ÏÂÔØGreenJVM£¬ÆäÖÐÁ½¸öÖ÷ÒªÎļþ(GreenJVM.exeºÍvm.cfg)
3¡¢ÓüÆÊ±¾´ò¿ªvm.cfgÉèÖòÎÊý£¬²ÎÊýºÜ¶à£¬Ö»ÒªÉèÖÃÏÂÃæ¼¸¸ö¾Í¿ÉÒÔÓÃÁË£º
SET_VM_NAME=jre.rar
SET_START_JAR_PATH=***.jar &nbs ......
±¾ÎÄÔÖ·£ºhttp://blogger.org.cn/blog/more.asp?name=hongrui&id=46926
/**
* JavaÀïÊý×Öת×Ö·û´®Ç°Ãæ×Ô¶¯²¹0µÄʵÏÖ¡£
*
*/
public class TestStringFormat {
public static void ......
Àࣺ
·ÃÎÊÐÞÊηû ÐÞÊηû class ÀàÃû³Æ extends ¸¸ÀàÃû³Æ implement ½Ó¿ÚÃû³Æ
£¨·ÃÎÊÐÞÊηûÓëÐÞÊηûµÄλÖÿÉÒÔ»¥»»£©
·ÃÎÊÐÞÊηû
Ãû³Æ
˵Ã÷
±¸×¢
public
¿ÉÒÔ±»ËùÓÐÀà·ÃÎÊ£¨Ê¹Óã©
publicÀà±ØÐ붨ÒåÔÚºÍÀàÃûÏàͬµÄͬÃûÎļþÖÐ
package
¿ÉÒÔ±»Í¬Ò»¸ö°üÖеÄÀà·ÃÎÊ£¨Ê¹Óã©
ĬÈϵķÃÎÊȨÏÞ£¬¿ÉÒÔÊ¡ÂԴ˹ؼ ......
ÔÚÏîÄ¿ÖУ¬ÎÒÃǺܶ඼Óõ½ÁËxmlÎļþ£¬ÎÞÂÛÊDzÎÊýÅäÖû¹ÊÇÓëÆäËüϵͳµÄÊý¾Ý½»»¥¡£
½ñÌì¾ÍÀ´½²Ò»ÏÂJava ÖÐʹÓÃdom4jÀ´²Ù×÷XMLÎļþ¡£
ÎÒÃÇÐèÒªÒýÈëµÄ°ü£º
//Îļþ°ü
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileWriter;
//¹¤¾ß°ü
import java.util.Itera ......