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

java±ÊÊÔ»ã×Ü£¨2£©

41¡¢ÊÇ·ñ¿ÉÒԼ̳ÐStringÀà?
StringÀàÊÇfinalÀà¹Ê²»¿ÉÒԼ̳С£
42¡¢swtichÊÇ·ñÄÜ×÷ÓÃÔÚbyteÉÏ£¬ÊÇ·ñÄÜ×÷ÓÃÔÚlongÉÏ£¬ÊÇ·ñÄÜ×÷ÓÃÔÚStringÉÏ?
switch£¨expr1£©ÖУ¬expr1ÊÇÒ»¸öÕûÊý±í´ïʽ¡£Òò´Ë´«µÝ¸ø switch ºÍ case Óï¾äµÄ²ÎÊýÓ¦¸ÃÊÇ int¡¢ short¡¢ char »òÕß byte¡£long,string ¶¼²»ÄÜ×÷ÓÃÓÚswtich¡£
43¡¢try {}ÀïÓÐÒ»¸öreturnÓï¾ä£¬ÄÇô½ô¸úÔÚÕâ¸ötryºóµÄfinally {}ÀïµÄcode»á²»»á±»Ö´ÐУ¬Ê²Ã´Ê±ºò±»Ö´ÐУ¬ÔÚreturnÇ°»¹ÊǺó?
»áÖ´ÐУ¬ÔÚreturnÇ°Ö´ÐС£
44¡¢±à³ÌÌâ: ÓÃ×îÓÐЧÂʵķ½·¨Ëã³ö2³ËÒÔ8µÈ춼¸? 
2 << 3
45¡¢Á½¸ö¶ÔÏóÖµÏàͬ(x.equals(y) == true)£¬µ«È´¿ÉÓв»Í¬µÄhash code£¬Õâ¾ä»°¶Ô²»¶Ô?
²»¶Ô£¬ÓÐÏàͬµÄhash code¡£
46¡¢µ±Ò»¸ö¶ÔÏó±»µ±×÷²ÎÊý´«µÝµ½Ò»¸ö·½·¨ºó£¬´Ë·½·¨¿É¸Ä±äÕâ¸ö¶ÔÏóµÄÊôÐÔ£¬²¢¿É·µ»Ø±ä»¯ºóµÄ½á¹û£¬ÄÇôÕâÀïµ½µ×ÊÇÖµ´«µÝ»¹ÊÇÒýÓô«µÝ? 
ÊÇÖµ´«µÝ¡£Java ±à³ÌÓïÑÔÖ»ÓÐÖµ´«µÝ²ÎÊý¡£µ±Ò»¸ö¶ÔÏóʵÀý×÷Ϊһ¸ö²ÎÊý±»´«µÝµ½·½·¨ÖÐʱ£¬²ÎÊýµÄÖµ¾ÍÊǶԸöÔÏóµÄÒýÓ᣶ÔÏóµÄÄÚÈÝ¿ÉÒÔÔÚ±»µ÷Óõķ½·¨Öиı䣬µ«¶ÔÏóµÄÒýÓÃÊÇÓÀÔ¶²»»á¸Ä±äµÄ¡£
47¡¢µ±Ò»¸öÏ߳̽øÈëÒ»¸ö¶ÔÏóµÄÒ»¸ösynchronized·½·¨ºó£¬ÆäËüÏß³ÌÊÇ·ñ¿É½øÈë´Ë¶ÔÏóµÄÆäËü·½·¨?
²»ÄÜ£¬Ò»¸ö¶ÔÏóµÄÒ»¸ösynchronized·½·¨Ö»ÄÜÓÉÒ»¸öÏ̷߳ÃÎÊ¡£
48¡¢±à³ÌÌâ: Ð´Ò»¸öSingleton³öÀ´¡£
SingletonģʽÖ÷Òª×÷ÓÃÊDZ£Ö¤ÔÚJavaÓ¦ÓóÌÐòÖУ¬Ò»¸öÀàClassÖ»ÓÐÒ»¸öʵÀý´æÔÚ¡£
Ò»°ãSingletonģʽͨ³£Óм¸ÖÖÖÖÐÎʽ:
µÚÒ»ÖÖÐÎʽ: ¶¨ÒåÒ»¸öÀ࣬ËüµÄ¹¹Ô캯ÊýΪprivateµÄ£¬ËüÓÐÒ»¸östaticµÄprivateµÄ¸ÃÀà±äÁ¿£¬ÔÚÀà³õʼ»¯Ê±ÊµÀý»°£¬Í¨¹ýÒ»¸öpublicµÄgetInstance·½·¨»ñÈ¡¶ÔËüµÄÒýÓÃ,¼Ì¶øµ÷ÓÃÆäÖеķ½·¨¡£
public class Singleton {
private Singleton(){}
¡¡¡¡    //ÔÚ×Ô¼ºÄÚ²¿¶¨Òå×Ô¼ºÒ»¸öʵÀý£¬ÊDz»ÊǺÜÆæ¹Ö£¿
¡¡¡¡    //×¢ÒâÕâÊÇprivate Ö»¹©ÄÚ²¿µ÷ÓÃ
¡¡¡¡    private static Singleton instance = new Singleton();
¡¡¡¡    //ÕâÀïÌṩÁËÒ»¸ö¹©Íⲿ·ÃÎʱ¾classµÄ¾²Ì¬·½·¨£¬¿ÉÒÔÖ±½Ó·ÃÎÊ¡¡¡¡
¡¡¡¡    public static Singleton getInstance() {
¡¡¡¡¡¡¡¡&nb


Ïà¹ØÎĵµ£º

Java ÊäÈë/Êä³ö

 ÔÚjavaÓïÑÔÖУ¬I/OµÄ·½Ê½ÊÇÁ÷µÄ·½Ê½¡£Á÷£¨stream£©ÕâÊǸöѧϰjavaÊäÈëÊä³öµÄ×î»ù±¾µÄ¸ÅÄî¡£Á÷ÊÇ×Ö½Ú´ÓÔ´µ½Ä¿µÄµÄÓÐÐòÐòÁС£Ò»·½ÃæÊÇ×Ö½Ú£¬Ò»·½ÃæÊÇÓÐÐòµÄ¡£Á÷ÃèÊöµÄÊÇÒ»¸ö¹ý³Ì£¬Ë³ÐòÑϸñ¡£Ò»¸öÐèÒª¼üÅÌÊäÈëµÄ³ÌÐò¿ÉÒÔÓÃÁ÷À´×öµ½ÕâÒ»µã¡£Á½ÖÖ»ù±¾µÄÁ÷ÊÇ£ºÊäÈëÁ÷ºÍÊä³öÁ÷¡£Äã¿ÉÒÔ´ÓÊäÈëÁ÷¶Á£¬µ«Äã²»ÄܶÔËüд¡£Òª´ÓÊäÈëÁ ......

JavaʵÏÖĿ¼²éÕÒÓëÎı¾ÔĶÁ

 1.ʵÏÖÎı¾ÔĶÁ
package AllAboutFile;
/**
 *
 * @author lucifer
 */
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class FileViewer extends Frame implements ActionListener{
     String directory;
     Text ......

javaÃüÃû規·¶

 來Ô´£ºhttp://www.blogjava.net/oxidy/articles/213105.html
1.°üÃüÃû:È«²¿×ÖĸСд:cn.package.bean
2.ÀàÃüÃû:µ¥´ÊµÄÊ××Öĸ´óд:SimpleBean
3.ÊôÐÔÃû³Æ:µÚÒ»¸öµ¥´ÊµÄÊ××ÖĸСд,Ö®ºóÿ¸öµ¥´ÊµÄÊ××Öĸ´óдstudentName
4.·½·¨ÃüÃû:ÓëÊôÐÔÃüÃûÏàͬ:public
void sayHello()
5.³£Á¿ÃüÃû:È«²¿µ¥´Ê´óд:final S ......

java server2000Á¬½ÓÊý¾Ý¿â

 Ìõ¼þ£ºÒÑ°²×°J2SEºÍJ2EE¡£
Microsoft SQL Server 2000 Driver for JDBCÊÇ΢Èí¹«Ë¾Ãâ·ÑÌṩÃâ·ÑÏÂÔصÄÒ»¸öÈí¼þ£¬Çë·ÃÎÊ£º http://www.microsoft.com/sql/default.asp£¬ÏÂÔغóÎļþÃûΪ£ºsetup.exe£¬°²×°ºó£¬Ä¬ÈÏ·¾¶ÊÇ£º%Program Files%\Microsoft SQL Server 2000 Driver for JDBC£¬¸ÃĿ¼ÏÂLIBĿ¼ÀïÓÐ3¸öjarÎļþ¡£ ......

javaÎļþ²Ù×÷

 1.´´½¨Îļþ¼Ð 
File myFolderPath = new File(%%1); 
try { 
if (!myFolderPath.exists()) { 
     myFolderPath.mkdir(); 


catch (Exception e) { 
System.out.println("н¨Ä¿Â¼²Ù×÷³ö´í"); 
e.printStackTrace();  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ