JAVA ѧϰ
ΪÁË°Ñѧµ½ÖªÊ¶×ܽáÆðÀ´£¬ÌØ¿ª´ËÎÄ¡£Ö÷ÒªÊÇ°ÑÿÌìѧµ½µÄ¶«Î÷¼ÓÒԼǼ£¬²»ÖÁÓÚ±ä³É´ó¹·ÐÜ¡£
20100310
½ñÌìÔÚÂÛ̳¿´ÈË·¢ÁËÁ½µÀjavaÌ⣬²»´í£¬°ÑÎÊÌâºÍ´ð°¸¶¼¼Ó½øÀ´£¬ÒÔ±ãÒÔºó²Î¿¼¡£
ÎÊÌâ:
ÒªÇóʵÏÖ·½·¨ÀïÃæµÄ´úÂ룺
1. function1()
·µ»ØÏàͬ闊¶È數×ÖÐÍ×Ö´®. Àý:
function1(“000000”) => “000001”
function1(”0023") => “0024”
function1(“0009”) => “0010”
function1(“000099”) => “000100”
function1(“9”) => “0” //號碼Ñ環ÔÙÓÃ
³Ìʽ½Ó¿Ú:
public static String function1(String num){....}
2. function2()
將數×ÖËÄ捨ÎåÈëÖÁijС數λ, 並·µ»ØÖ¸¶¨Î»數×Ö´®
function2(123.455,2) => 123.46
function2(123.449,2) => 123.45
function2(123.44,3) => 123.440
function2(123.4455,3) => 123.446
function2(123.4499,3) => 123.450
function2(123.9,0) => 124
³Ìʽ½Ó¿Ú:
public static double function2(double value,int decimalPlaces){....}
-------------------------------------------------------------------------------------
´ð°¸£º
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.RoundingMode;
import java.text.NumberFormat;
public class test {
public String function1(String str){
String rstr="";
int snum = Integer.parseInt(str);
int len =str.length();
snum++;
rstr =String.format("%0"+len+"d",(int)(snum % Math.pow(10,len)));
return rstr;
}
public double function2(double value, int decimalPlaces) {
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setRoundingMode(RoundingMode.HALF_UP); // ËÄÉáÎåÈë
nf.setMax
Ïà¹ØÎĵµ£º
ÕâÊÇÎÒµÚÒ»´Îд¼¼Êõ²©ÎÄ£¬Ï²»¶´ó¼ÒÌá³ö±¦¹óÒâ¼û¡£ÕâƪÎÄÕÂÖ÷ÒªÏë½²Èý¸öÎÊÌâ¡£
µÚÒ»£ºHibernateºÍJDBCµÄÇø±ð¡£
×÷Ϊjava³ÌÐòÔ±£¬ÎÒ¾õµÃŪÇå³þHibernateÓëJDBCµÄÇø±ð£¬²»½ö¶Ô´òºÃÔúʵµÄ»ù±¾¹¦±È½ÏÖØÒª£¬¾ÍÊÇÒÔºóµÄѧϰ£¬¿ª·¢Ò²¾ßÓÐÏ൱µÄ½è¼øÒâÒå¡£¿ÉϧµÄÊÇÏÖÔÚÓкÃЩ³ÌÐòÔ±²»Ð¼ÓÚѧ ......
ͨ³£µÄ¹ÛÄîÈÏΪ£¬ÊÂÎñ½öÓëÊý¾Ý¿âÏà¹Ø¡£
ÊÂÎñ±ØÐë·þ´ÓISO/IECËùÖƶ¨µÄACIDÔÔò¡£ACIDÊÇÔ×ÓÐÔ£¨atomicity£©¡¢Ò»ÖÂÐÔ£¨consistency£©¡¢¸ôÀëÐÔ
£¨isolation£©ºÍ³Ö¾ÃÐÔ£¨durability£©µÄËõд¡£ÊÂÎñµÄÔ×ÓÐÔ±íʾÊÂÎñÖ´Ðйý³ÌÖеÄÈκÎʧ°Ü¶¼½«µ¼ÖÂÊÂÎñËù×öµÄÈκÎÐÞ¸ÄʧЧ¡£Ò»ÖÂÐÔ±íʾ
µ±ÊÂÎñÖ´ÐÐʧ°Üʱ£¬ËùÓб»¸ÃÊÂÎñÓ°ÏìµÄÊý¾Ý ......
Ò»£¬ package,importÒýÈëÔÒò£º
package:
ÎÒÃǶ¼ÊìϤ³¬ÊУ¬³¬ÊÐËäÈ»ÅӴ󣬶«Î÷·±¶à£¬µ«È´¹ÜÀíµÄ¾®¾®ÓÐÌõ£¬µ±ÕÒijÑù¶«¶«Ê±£¬ÎÒÃÇÒ²ºÜÈÝÒ×ÕÒ
µ½£¬ËüµÄÒ»¸öÖØÒªµÄÔÒò¾ÍÊDzÉÓÃÁË·ÖÀà·ÅÖûúÖÆ£¬ÎïÆ··ÖÃűðÀà·ÅÖÃÔÚרÃŵÄÇøÓò£¬¼È·½±ã¹ÜÀí£¬ÓÖ·½±ãÑ°ÕÒ
PackageÒ²ÊÇÒ»¸ö·ÖÀà·ÅÖö«¶«µÄÇøÓò£¬²»¹ýËü·Åµ ......
Ò»£¬ package,importÒýÈëÔÒò£º
package:
ÎÒÃǶ¼ÊìϤ³¬ÊУ¬³¬ÊÐËäÈ»ÅӴ󣬶«Î÷·±¶à£¬È´¹ÜÀíµÄ¾®¾®ÓÐÌõ£¬ºÜÈÝÒ×ÕÒµ½Ä³Ñù¶«¶«£»£¬Ö®ËùÒÔÄÜÈç´Ë£¬Ò»¸öÖØÒªµÄÔÒò¾ÍÊDzÉÓÃÁË·ÖÀà·ÅÖ㬼ȷ½±ãÁ˹ÜÀí£¬ÓÖ·½±ãÁËÑ°ÕÒ
PackageÒ²ÊÇÒ»¸ö·ÖÀà·ÅÖö«¶«µÄÇøÓò£¬²»¹ýËü·ÅµÄ²»ÊÇÉÌÆ·¶øÊÇjavaÖеÄÀà¡£JavaÖÐÓи÷ÖÖ¸÷ÑùµÄÀ࣬
ÄÚÈÝ·á ......
Package µÄÃüÃû
Package µÄÃû×ÖÓ¦¸Ã¶¼ÊÇÓÉÒ»¸öСдµ¥´Ê×é³É¡£
Class µÄÃüÃû
Class µÄÃû×Ö±ØÐëÓÉ´óд×Öĸ¿ªÍ·¶øÆäËû×Öĸ¶¼Ð¡Ð´µÄµ¥´Ê×é³É
Class ±äÁ¿µÄÃüÃû
±äÁ¿µÄÃû×Ö±ØÐëÓÃÒ»¸öСд×Öĸ¿ªÍ·¡£ºóÃæµÄµ¥´ÊÓôóд×Öĸ¿ªÍ·¡£
Static Final&nbs ......