Unlike methods, a constructor cannot be abstract, static, final, native or synchronized.
1. A constructor is not inherited, so there is no need to declare it final
2. As the same reason above, an abstract constructor could never be implemented.
3. A constructor is always invoked with respect to an object, so it makes no sense for a constructor to be static.
4. There is no practical need for a constructor to be synchronized, because it would lock the object under construction, which is normally not made available to other threads until all constructors for the object have completed their work.
5. The lack of native constructors is an arbitrary language design choice that makes it easy for an implementation of the Java virtual machine to verify that superclass constructors are always properly invoked during object creation.
緲昏瘧濡備笅錛?/p>
涓嶅悓浜庢柟娉曪紝鏋勯犲櫒涓嶈兘鏄痑bstract, static, final, native, strictfp, 鎴栬卻ynchronized鐨?
1.鏋勯犲櫒涓嶆槸閫氳繃緇ф壙寰楀埌鐨勶紝鎵浠ユ病鏈夊繀瑕佹妸瀹冨0鏄庝負final鐨勩?br>
2.鍚岀悊錛屼竴涓娊璞$殑鏋勯犲櫒灝嗘案榪滀笉浼氳瀹炵幇銆傦紙鎵浠ヤ篃涓嶈兘澹版槑涓篴bstract鐨勶級
3.鏋勯犲櫒鎬繪槸鍏寵仈涓涓璞¤岃璋冪敤錛屾墍浠ユ妸瀹冨0鏄庝負static鏄病鏈夋剰涔夌殑銆?br>
4.娌℃湁瀹為檯鐨勯渶瑕佹妸鏋勯犲櫒瀹氫箟鎴愬悓姝ョ殑錛屽洜涓哄畠?yōu)畣浼氬湪鏋勯犵殑鏃跺欓攣浣忚瀵硅薄錛岀洿鍒版墍鏈夌殑鏋勯犲櫒瀹屾垚瀹冧滑鐨勫伐浣滐紝榪欎釜鏋勯犵殑榪囩▼瀵瑰叾瀹冪嚎紼嬫潵璇達紝閫氬父鏄笉鍙闂殑銆?br>
5.娌℃湁鏈湴鐨勬瀯閫犲櫒鏄換鎰忎竴縐嶈璦鐨勮璁¢夋嫨錛岃繖鏍蜂細浣垮緱鍦ㄥ垱寤哄璞$殑榪囩▼涓璊VM瀹炵幇寰堝鏄撳幓鏍¢獙鐖剁被鐨勬瀯閫犲櫒鏄惁鎬繪槸琚紜湴璋冪敤浜嗐?br>
錛堟湰鍦板寲鐨勬柟娉曟儏鍐電壒鍒鏉傦紝鎵浠VM璋冪敤璧鋒潵闈炲父楹葷儲錛岄渶瑕佽冭檻寰堝縐嶆儏鍐碉紝娌℃湁native鍏抽敭瀛楃殑鎯呭喌涓嬶紝JVM瀹炵幇璧鋒潵姣旇緝瀹規(guī)槗銆傦級
PS錛氬彈淇哄甯堢殑褰卞搷錛岀涓嬈℃湁榪欑鍐插姩鎯沖幓緲昏瘧涓浜涜嫳鏂囪祫鏂欍傝櫧鐒剁炕璇戝緱寰堢儌錛屼絾寰堟鎱般?

]]>