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

Effective Java¶ÁÊé±Ê¼Ç

package chape8;
import java.math.BigDecimal;
/**
* 8-48
* Èç¹ûÏëÒªÖªµÀ¾«È·µÄ´ð°¸£¬¾ÍÒª±ÜÃâʹÓÃdoubleºÍfloat
¶ÔÓÚ½ðÈÚÐÐÒµÀ´Ëµ£¬¶ÔÊý¾ÝµÄÑÏÕûÐÔÒªÇóÊǺܸߵģ¬²»ÈÝ°ëµãÂí»¢£¬
ÄÇ´ó¼Ò¶¼ÖªµÀÔÙÎÒÃǵÄJavaÓïÑÔÀïÃæÓÐÁ½¸ö¸¡µãÊýÀàÐ͵ıäÁ¿floatºÍdouble£¬
¿ÉÄÜ´ó¼Ò»áÈÏΪËûÃǵľ«¶È¶ÔÓÚ½ðÈÚÐÐÒµÕâÑù¶ÔÊý×ÖÃô¸ÐµÄÐÐÒµÀ´Ëµ£¬ÒѾ­¹»ÓÃÁË£¬
µ«ÊÇÔÚ¿ª·¢µ±ÖУ¬ÎÒÃÇÒª¾¡Á¿ÉÙʹÓÃdoubleºÍfloat£¬ÒòΪÈÃËûÃǾ«È·µÄ±í´ï0.1ÊDz»¿ÉÄܵġ£
ÄÇÎÒÃÇÈçºÎ½â¾öÕâ¸öÎÊÌâÄØ£¬
´ð°¸ÊÇʹÓÃBigDecimal,int»òÕßlong½øÐлõ±Ò¼ÆËã¡£
ÔÚÕâÀï¶Ô´ó¼ÒµÄÖÒ¸æÊÇ£º
floatºÍdouble ÀàÐÍÓÈÆä²»ÊʺÏÓÃÓÚ»õ±Ò¼ÆË㣻ÒòΪÈÃÒ»¸öfloat»òÕßdouble
¾«È·µØ±íʾ0.1»òÕß10µÄÈκÎÆäËû¸ºÊý´Î·½Öµ£¬¶¼ÊDz»¿ÉÄܵģ»
* @author lee
*
*/
public class Chape48 {
/**
* @param args
*/
public static void main(String[] args) {
/**
* À´¿´Ò»¸öÀý×Ó
* Äã¿Ú´üÀïÓÐ1ÃÀÔª£¨100ÃÀ·Ö£©£¬Äã´òËãÂòÌÇ£¬Ìǵļ۸ñΪ10ÃÀ·Ö20ÃÀ·Ö
* 30ÃÀ·ÖµÈµÈ Ò»Ö±µ½1ÃÀ·Ö Äã´òËã´Ó10ÃÀ·ÖµÄ¿ªÊ¼Âò£¬Ã¿ÖÖ¼Û¸ñÖ»ÂòÒ»¸ö
* ÄÇÄãÄÜÂò¼¸¸öÌÇÄØ£¿ÄÜÕһضàÉÙÄØ£¿
*/
/* double sum = 1;
int count = 0 ;
for(double x = .10;x<sum;x+=.10)
{
sum-=x;
count++;
}
System.out.println(sum);
System.out.println(count);*/
/**
* Êä³ö½á¹ûÊÇ
* 0.3999999999999999ºÍ3
* ÎÒÃÇÓÃÊÖËãһϠ100-10-20-30=40
* ÄǾÍÊÇ˵ÎÒÃÇ»¹¿ÉÒÔÂòÒ»¸ö.40µÄÌÇ ÄÇô³ÌÐòÄÇÀï´íÁË£¿
* ´íÎó¾ÍÔÚÓÚÎÒÃÇÓÃÁËdouble
* ½â¾ö°ì·¨¾ÍÊÇÓÃBigDecimal »òÕßint »òÕßlong ½øÐлõ±ÒµÄ¼ÆËã
*/
BigDecimal sum1 = new BigDecimal("1");
BigDecimal price = new BigDecimal(".10");
int count1 = 0 ;
for(BigDecimal b = price;sum1.compareTo(b) >=0 ;b=b.add(price))
{
sum1 = sum1.subtract(b);
count1++;
}
System.out.println(sum1);
System.out.println(count1);
/**
* Êä³ö½á¹û0.00ºÍ4 ÕâÑù¾ÍÕýÈ·ÁË
* ¹ØÓÚBigDecimalµÄ·½·¨ÎÒÃÇÏÂÈ¥ÔÙ×Ðϸ¿´¿´£»
* ÕâÀïҪ˵µÄÊÇBigDecimalÊÇÒýÓÃÊý¾ÝÀàÐÍ
*/
/**
* ×ܶøÑÔÖ®£º ¶ÔÓÚÈκÎÒª¾«È·´ð°¸µÄ¼ÆËãÈÎÎñ£¬Çë²»ÒªÓÃdoubleºÍfloat£¬Èç¹ûÄãÏë
* ¼ÆËãÊ®½øÖÆСÊýµã£¬²¢ÇÒ²»½éÒâ·Ç»ù±¾ÀàÐÍ´øÀ´µÄ²»±ã£¬ÄǾÍÓÃBigDecimal£»Ê¹ÓÃ
* BigDecimal»¹Óиö¶îÍâµÄºÃ´¦¾ÍÊÇËûÔÊÐíÄãÍêÈ«¿ØÖÆÉáÈ룬ÿµ±Ò»¸ö²Ù×÷Éæ¼°


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

java¼¯ºÏÀà

 ArrayList ºÍVectorÊDzÉÓÃÊý×鷽ʽ´æ´¢Êý¾Ý£¬´ËÊý×éÔªËØÊý´óÓÚʵ¼Ê´æ´¢µÄÊý¾ÝÒÔ±ãÔö¼ÓºÍ²åÈëÔªËØ£¬¶¼ÔÊÐíÖ±½ÓÐòºÅË÷ÒýÔªËØ£¬µ«ÊDzåÈëÊý¾ÝÒªÉè¼Æµ½Êý×éÔªËØÒƶ¯µÈÄÚ´æ²Ù×÷£¬ËùÒÔË÷ÒýÊý¾Ý¿ì²åÈëÊý¾ÝÂý£¬VectorÓÉÓÚʹÓÃÁËsynchronized·½·¨£¨Ḭ̈߳²È«£©ËùÒÔÐÔÄÜÉϱÈArrayListÒª²î£¬LinkedListʹÓÃË«ÏòÁ´±íʵÏÖ´æ´¢£¬°´Ðòº ......

JAVA ×Ô¶¯Éú³ÉiBATIS xmlÎļþl

3.package com.ncs.opts.tools;
import java.util.HashMap;
import java.util.Map;
import com.ncs.opts.common.icp.dao.po.audit.IcpMainHistory;
import com.ncs.opts.common.icp.dao.po.audit.IcpModifyHistory;
import com.ncs.opts.common.icp.dao.po.audit.IcpSiteAccessHistory;
import com.ncs.opts.common.i ......

JAVA AJAX½Ì³ÌµÚËÄÕ—AJAXºÍMVCµÄ¼òµ¥½áºÏ

 ÕâÀïÎÒÃÇÔÙÀí½âÁËAJAXºó£¬¿ªÊ¼À´ÓÃʵÀý¸ÐÊÜAJAXµÄÁ¦Á¿¡£
½ñÌìÎÒ×îºóҪʵÏÖµÄЧ¹û£¬µ±Êó±ê·Åµ½Í¼Æ¬ÉÏʱ»á¸ù¾Ý£¬»á°ÑÊý¾Ý¿â¿âÀïµÄÊý¾Ý¶Á³ö£¬Í¨¹ýÏÔʾ¿òÏÔʾ³öÀ´¡£Õâ¸öÔںܶàÍøÉÏÉ̵궼ÓÐÓõ½ÕâÀïЧ¹û£¬ÎÒÃÇÕâÀïÓÃAJAXÀ´ÊµÏÖÕâ¸öЧ¹û¡£Õâ¸öʵÀýÀï½áºÏÁËMySql¡¢Servlet»¹ÓÐJs£¬ÀíÂÛÐÔºÜÉÙ£¬µ«Í¨¹ýʵ¼ùÀ´¸ÐÊÜÀíÂÛ֪ʶ¡£
......

jsp,java±àÂëÔ­Àí

Îļþ´ò¿ªÊ±ºòÊÇͨ¹ýÎļþÍ·À´È·¶¨ÎļþµÄ±àÂë
StreamReader   sr=new   StreamReader(@"F:\cym\temp\1.txt");  
  sr.CurrentEncoding   //·µ»Ø±àÂë
ÊÀ½çÉϵĸ÷µØÇø¶¼Óб¾µØµÄÓïÑÔ¡£µØÇø²îÒìÖ±½Óµ¼ÖÂÁËÓïÑÔ»·¾³µÄ²îÒì¡£ÔÚ¿ª·¢Ò»¸ö¹ú¼Ê»¯³ÌÐòµÄ¹ý³ÌÖУ¬´¦ÀíÓïÑÔÎ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ