Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : java

JAVA³£ÓÃÀàµÄʹÓ÷½·¨

JAVA³£ÓÃÀàµÄʹÓ÷½·¨
£±¡¢IntegerÀà
£²¡¢FloatÀà
£³¡¢DoubleÀà
£´¡¢CharacterÀà
£µ¡¢StringÀà
£¶¡¢StringTokenizerÀà
£·¡¢StringBufferÀà
£¸¡¢RandomÀà
1£®IntegerÀàµÄʹÓ÷½·¨
Interger£ºÕûÊýÀàÐÍ
£±¡¢ÊôÐÔ¡£
static int MAX_VALUE£º·µ»Ø×î´óµÄÕûÐÍÊý£»
static int MIN_VALUE£º·µ»Ø×îСµÄÕûÐÍÊý£»
static Class TYPE £º·µ»Øµ±Ç°ÀàÐÍ¡£
Àý×Ó£º
System.out.println("Integer.MAX_VALUE: " + Integer.MAX_VALUE );
½á¹ûΪ£ºInteger.MAX_VALUE: 2147483647
£²¡¢¹¹Ô캯Êý¡£
Integer(int value) £ºÍ¨¹ýÒ»¸öintµÄÀàÐ͹¹Ôì¶ÔÏó£»
Integer(String s) £ºÍ¨¹ýÒ»¸öStringµÄÀàÐ͹¹Ôì¶ÔÏó£»
Àý×Ó£º
Integer i = new Integer("1234");
Éú³ÉÁËÒ»¸öֵΪ1234µÄInteger¶ÔÏó¡£
£³¡¢·½·¨¡£
˵Ã÷£º
1. ËùÓз½·¨¾ùΪpublic£»
2. Êéд¸ñʽ£º£ÛÐÞÊηû£Ý¡¡<·µ»ØÀàÐÍ> <·½·¨Ãû£¨£Û²ÎÊýÁбí£Ý£©>
È磺
static int parseInt(String s) ±íʾ£º´Ë·½·¨£¨parseInt£©ÎªÀà·½·¨£¨static£©£¬·µ»ØÀàÐÍΪ£¨int£©£¬·½·¨ËùÐè²ÎÊýΪStringÀàÐÍ¡£
1. byteValue()£ºÈ¡µÃÓÃbyteÀàÐͱíʾµÄÕûÊý£»
2. int compareTo(Integer anotherInteger) £º±È½ÏÁ½¸öÕûÊý¡£ÏàµÈʱ·µ»Ø£°£»Ð¡ÓÚ ......

java¶ÁÈ¡XMLÎļþÀïÃæµÄÊý¾ÝÖ®DOMʵÏÖ

import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.*;
public class ReadXML {
private File file;

public ReadXML(String filename){
File file=new File(filename);
this.file=file;
}
/**
*
* @return the instance of Document
*/
public Document getDOM(){
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
DocumentBuilder db;
Document document=null;
try{
db=dbf.newDocumentBuilder();
document=db.parse(file);
}catch(Exception e ){
e.printStackTrace();
}
return document;
}

/**
*
* @param tagName
* @return
*/
public String getInfoByTagName(String tagName)
{
String info="";
Document document=this.getDOM();

//»ñÈ¡NodeName ΪtagNameµÄ½Úµã×é
NodeList nl=document.getElementsByTagName(tagName);

......

ÉîÈë̽Ë÷Java¹¤×÷Ô­Àí£ºJVM£¬ÄÚ´æ»ØÊÕ¼°ÆäËû

JavaÓïÑÔÒýÈëÁËJavaÐéÄâ»ú£¬¾ßÓÐ¿çÆ½Ì¨ÔËÐеŦÄÜ£¬Äܹ»ºÜºÃµØÊÊÓ¦¸÷ÖÖWebÓ¦Óá£Í¬Ê±£¬ÎªÁËÌá¸ßJavaÓïÑÔµÄÐÔÄܺͽ¡×³ÐÔ£¬»¹ÒýÈëÁËÈçÀ¬»ø»ØÊÕ»úÖÆµÈй¦ÄÜ£¬Í¨¹ýÕâЩ¸Ä½øÈÃJava¾ßÓÐÆä¶ÀÌØµÄ¹¤×÷Ô­Àí¡£
1£®JavaÐéÄâ»ú
JavaÐéÄâ»ú£¨Java Virtual Machine£¬JVM£©ÊÇÈí¼þÄ£ÄâµÄ¼ÆËã»ú£¬Ëü¿ÉÒÔÔÚÈκδ¦ÀíÆ÷ÉÏ£¨ÎÞÂÛÊÇÔÚ¼ÆËã»úÖл¹ÊÇÔÚÆäËûµç×ÓÉ豸ÖУ©°²È«¼æÈݵØÖ´Ðб£´æÔÚ.classÎļþÖеÄ×Ö½ÚÂë¡£JavaÐéÄâ»úµÄ“»úÆ÷Âë”±£´æÔÚ.classÎļþÖУ¬ÓÐʱҲ¿ÉÒÔ³ÆÖ®Îª×Ö½ÚÂëÎļþ¡£
Java³ÌÐòµÄ¿çÆ½Ì¨ÌØÐÔÖ÷ÒªÊÇÖ¸×Ö½ÚÂëÎļþ¿ÉÒÔÔÚÈκξßÓÐJavaÐéÄâ»úµÄ¼ÆËã»ú»òÕßµç×ÓÉ豸ÉÏÔËÐУ¬JavaÐéÄâ»úÖеÄJava½âÊÍÆ÷¸ºÔð½«×Ö½ÚÂëÎļþ½âÊͳÉÎªÌØ¶¨µÄ»úÆ÷Âë½øÐÐÔËÐС£Òò´ËÔÚÔËÐÐʱ£¬JavaÔ´³ÌÐòÐèҪͨ¹ý±àÒëÆ÷±àÒë³ÉΪ.classÎļþ¡£
JavaÐéÄâ»úµÄ½¨Á¢ÐèÒªÕë¶Ô²»Í¬µÄÈíÓ²¼þƽ̨À´ÊµÏÖ£¬¼ÈÒª¿¼ÂÇ´¦ÀíÆ÷µÄÐͺţ¬Ò²Òª¿¼ÂDzÙ×÷ϵͳµÄÖÖÀà¡£ÓÉ´ËÔÚSPARC½á¹¹¡¢X86½á¹¹¡¢MIPSºÍPPCµÈǶÈëʽ´¦ÀíоƬÉÏ£¬ÔÚUNIX¡¢Linux¡¢WindowsºÍ²¿·Öʵʱ²Ù×÷ϵͳÉ϶¼¿ÉʵÏÖJavaÐéÄâ»ú¡£
2£®ÎÞÓÃÄÚ´æ×Ô¶¯»ØÊÕ»úÖÆ
ÔÚ³ÌÐòµÄÖ´Ðйý³ÌÖУ¬²¿·ÖÄÚ´æÔÚʹÓùýºó¾Í´¦ÓÚ·ÏÆú״̬£¬Èç¹û²»¼°Ê±½øÐлØÊÕ£¬ºÜÓпÉÄܻᵼÖÂÄÚ´æÐ¹Â©£ ......

Java¶àÏß³ÌʵÏÖÒì²½µ÷ÓÃ

ÔÚJAVAƽ̨,ʵÏÖÒì²½µ÷ÓõĽÇÉ«ÓÐÈçÏÂÈý¸ö½ÇÉ«:µ÷ÓÃÕß Ìá»õµ¥ ÕæÊµÊý¾Ý
Ò»¸öµ÷ÓÃÕßÔÚµ÷ÓúÄʱ²Ù×÷,²»ÄÜÁ¢¼´·µ»ØÊý¾Ýʱ,ÏÈ·µ»ØÒ»¸öÌá»õµ¥.È»ºóÔÚ¹ýÒ»¶Ïʱ¼äºóƾÌá»õµ¥À´»ñÈ¡ÕæÕýµÄÊý¾Ý.
È¥µ°¸âµêÂòµ°¸â£¬²»ÐèÒªµÈµ°¸â×ö³öÀ´£¨¼ÙÉèÏÖ×öÒªºÜ³¤Ê±¼ä£©£¬Ö»ÐèÒªÁì¸öÌá»õµ¥¾Í¿ÉÒÔÁË£¨È¥¸É±ðµÄÊÂÇ飩£¬µÈµ½µ°¸â×öºÃÁË£¬ÔÙÄÃÌá»õµ¥È¡µ°¸â¾Í¿ÉÒÔÁË¡£
public class Main {
public static void main(String[] args) {
System.out.println("main BEGIN");
Host host = new Host();
Data data1 = host.request(10, 'A');
Data data2 = host.request(20, 'B');
Data data3 = host.request(30, 'C');
System.out.println("main otherJob BEGIN");
try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
System.out.println("main otherJob END");
System.out.println("data1 = " + data1.getContent());
System.out.println("data2 = " + data2.getContent());
System.out.println("data3 = " + data3.getContent());
System.out.println("main END");
}
}
ÕâÀïµÄmainÀà¾ÍÏ൱ÓÚ“¹Ë¿Í”£¬host¾ÍÏ൱ÓÚ“µ°¸âµê”£¬¹Ë ......

Java¹Ø¼ü×Öfinal¡¢staticʹÓÃ×ܽ᡾ת¡¿

 Ò»¡¢final
        ¸ù¾Ý³ÌÐòÉÏÏÂÎÄ»·¾³£¬Java¹Ø¼ü×ÖfinalÓГÕâÊÇÎÞ·¨¸Ä±äµÄ”»òÕß“ÖÕ̬µÄ”º¬Ò壬Ëü¿ÉÒÔÐÞÊηdzéÏóÀà¡¢·Ç³éÏóÀà³ÉÔ±·½·¨ºÍ±äÁ¿¡£Äã¿ÉÄܳöÓÚÁ½ÖÖÀí½â¶øÐèÒª×èÖ¹¸Ä±ä£ºÉè¼Æ»òЧÂÊ¡£
        finalÀ಻Äܱ»¼Ì³Ð£¬Ã»ÓÐ×ÓÀ࣬finalÀàÖеķ½·¨Ä¬ÈÏÊÇfinalµÄ¡£
        final·½·¨²»Äܱ»×ÓÀàµÄ·½·¨¸²¸Ç£¬µ«¿ÉÒÔ±»¼Ì³Ð¡£
        final³ÉÔ±±äÁ¿±íʾ³£Á¿£¬Ö»Äܱ»¸³ÖµÒ»´Î£¬¸³ÖµºóÖµ²»Ôٸı䡣
        final²»ÄÜÓÃÓÚÐÞÊι¹Ôì·½·¨¡£
        ×¢Ò⣺¸¸ÀàµÄprivate³ÉÔ±·½·¨ÊDz»Äܱ»×ÓÀà·½·¨¸²¸ÇµÄ£¬Òò´ËprivateÀàÐ͵ķ½·¨Ä¬ÈÏÊÇfinalÀàÐ͵ġ£
1¡¢finalÀà
        finalÀ಻Äܱ»¼Ì³Ð£¬Òò´ËfinalÀàµÄ³ÉÔ±·½·¨Ã»Óлú»á±»¸²¸Ç£¬Ä¬È϶¼ÊÇfinalµÄ¡£ÔÚÉè¼ÆÀàʱºò£¬Èç¹ûÕâ¸öÀ಻ÐèÒªÓÐ×ÓÀ࣬ÀàµÄʵÏÖϸ½Ú²»ÔÊÐí¸Ä±ä£¬²¢ÇÒÈ·ÐÅÕâ¸öÀ಻»áÔØ±»À©Õ¹£¬ÄÇô¾ÍÉè¼ÆÎªfinalÀà¡£
2¡¢final·½·¨
     ......

Java¿ª·¢ÕßÐè¼áÊØµÄÊ®´ó»ù±¾×¼Ôò¡¾×ª¡¿

 Ò»¡¢Îª´úÂë¼Ó×¢ÊÍ¡£ËäȻÿ¸öÈ˶¼ÖªµÀÕâµã£¬µ«ÓÐʱȴ²»×Ô¾õÍüÁËÂÄÐУ¬½ñÌìÄã“ÍüÁË”¼Ó×¢ÊÍÁËÂð£¿ËäÈ»×¢ÊͶԳÌÐòµÄ¹¦ÄÜûʲô“¹±Ï×”£¬µ«¹ýÒ»¶Îʱ¼ä£¬±ÈÈç˵Á½ÐÇÆÚÖ®ºó»òÕ߸ü³¤£¬»Ø¹ýÍ·À´¿´¿´×Ô¼ºµÄ´úÂ룬˵²»¶¨ÒѾ­¼Ç²»×¡ËüÊǸÉʲôµÄÁË¡£Èç¹ûÕâЩ´úÂëÊÇÄã¸öÈ˵ģ¬ÄÇ»¹ËãÊÇ×ßÔËÁË£¬²»ÐÒµÄÊÇ£¬µ±È»ÁË£¬´ó¶àÊýʱºò¶¼ÊDZðÈ˵IJ»ÐÒ£¬ºÜ¶àʱºò´ó¼Ò¶¼ÊÇÔÚΪ¹«Ë¾Ð´´úÂ룬д´úÂëµÄÈËÒ²ÐíÔçÒѾ­À뿪Á˹«Ë¾£¬µ«±ðÍüÁËÒ»¾ä¹Å»°£¬ÓÐÀ´ÓÐÍùÂΪËûÈË£¬Ò²ÎªÎÒÃÇ×Ô¼º£¬ÇëΪÄãµÄ´úÂë¼ÓÉÏ×¢ÊÍ¡£
¶þ¡¢²»ÒªÈÃÊÂÇ鸴ÔÓ»¯¡£³ÌÐòÔ±ÓÐʱºò×ÜÊǶԼòµ¥ÎÊÌâÏë³ö¸´ÔӵĽâ¾ö·½°¸£¬±ÈÈç˵£¬ÔÚÖ»ÓÐÎå¸öÓû§µÄ³ÌÐòÖÐÒýÈëEJB¡¢¶Ô³ÌÐòʵÏÖÁ˲¢²»ÐèÒªµÄ¿ò¼Ü£¨framework£©£¬Ö®ÀàµÄ»¹ÓÐÊôÐÔÎļþ¡¢ÃæÏò¶ÔÏó½â¾ö·½°¸¡¢¶àÏ̵߳ȵȡ£ÎªÊ²Ã´ÒªÕâÑù×öÄØ£¿Ò²ÐíÎÒÃDz¢²»ÖªµÀÊÇ·ñÕâÑù»á¸üºÃ£¬µ«ÕâÑù×öÒ²Ðí¿ÉÒÔѧµ½Ò»Ð©Ð¶«Î÷£¬»òÕßÈÃ×Ô¼º¸ü¸ÐÐËȤһЩ¡£Èç¹ûÊDz»ÖªµÀΪʲôÕâÑù×ö£¬½¨Òé¶àÇë½Ì¾­Ñé·á¸»µÄ³ÌÐòÔ±£¬Èç¹ûÊÇΪÁ˸öÈ˵ÄÄ¿µÄ£¬Âé·³ÈÃ×Ô¼º¸üרҵһµã¡£
Èý¡¢Ê¼ÖÕÀμǗ—“ÉÙ¼´ÊǺã¨Less is more£©²¢²»×ÜÊǶԵĔ¡£´úÂëЧÂÊËäÈ»ºÜÖØÒª£¬µ«ÔÚÐí¶à½â¾ö·½°¸ÖУ¬±àд¸ü ......
×ܼǼÊý:6386; ×ÜÒ³Êý:1065; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [868] [869] [870] [871] 872 [873] [874] [875] [876] [877]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ