³õѧJAVAÖ®Ò»
1¡¢ Ò»¸öÊýÈç¹ûÇ¡ºÃµÈÓÚÆäÒò×Ó£¨³ýÁ˱¾ÉíÒÔÍâµÄÔ¼ÊýÖ®ºÍ£©£¬¸ÃÊý¾Í³ÆΪ“ÍêÊý”¡£±àдһ¸ö Java Application ³ÌÐò£¬Çó³ö 1000 ÒÔÄÚµÄËùÓÐÍêÊý¡£
public class homework11
{
public static void main(String[] args)
//Êä³ö1000ÒÔÄÚµÄËùÓÐÍêÊý
{
int sum;
System.out.print( "**********1000ÒÔÄÚµÄËùÓÐÍêÊýÈçÏÂ:");
System.out.println(); //»»ÐÐ
for(int i = 1; i <= 1000; i++)
{
sum=0;//³õʼ»¯sum±äÁ¿£¬²¢ÔÚÿ¸öiµÄforµÄÑ»·ºóʹsumÖµ¹éÁã
for(int j = 1; j < i; j++){
if(i % j == 0) //È¡ÓàÊý
sum = sum + j;//Çói³ýÁ˱¾ÉíÒÔÍâµÄËùÓÐÔ¼ÊýÖ®ºÍ
}
if(sum == i) //ÅжÏiÊÇ·ñΪÍêÊý£¬¼´ÅжÏiÊÇ·ñµÈÓÚ³ýÁ˱¾ÉíÒÔÍâµÄÔ¼ÊýÖ®ºÍ
System.out.println( "-~-~-~-~-~-~-~-~-~-~-~-~-~-~~~~~"+i + "ÊÇÍêÊý");
//Êä³öÍêÊý
} //½áÊøforÑ»·
System.out.println(); //»»ÐÐ
} //½áÊømainº¯Êý
}//½áÊøclass
ÔËÐнá¹û£º
D:\jdk\xi>javac homework11.java
D:\jdk\xi>java homework11
**********1000ÒÔÄÚµÄËùÓÐÍêÊýÈçÏÂ:
-~-~-~-~-~-~-~-~-~-~-~-~-~-~~~~~6ÊÇÍêÊý
-~-~-~-~-~-~-~-~-~-~-~-~-~-~~~~~28ÊÇÍêÊý
-~-~-~-~-~-~-~-~-~-~-~-~-~-~~~~~496ÊÇÍêÊý
2¡¢±àдһ¸ö³ÌÐò£¬°Ñ±äÁ¿ n µÄ³õʼֵÉèÖÃΪ 1678£¬È»ºóÀûÓóý·¨ÔËËãºÍÈ¡ÓàÔËËã°Ñ±äÁ¿µÄÿλÊý×Ö¶¼Ìá³öÀ´²¢´òÓ¡£¬Êä³ö½á¹ûΪ£º n £½ 1678
public class homework12 {
// ÏÔʾָ¶¨ÊýµÄÿһλÊý×Ö
private void show() {
int n = 1678; //±äÁ¿ n µÄ³õʼֵÉèÖÃΪ 1678
int a,b,c,d; &nbs
Ïà¹ØÎĵµ£º
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
Producer-Consumer PatternµÄ²ÎÓëÕߣº
1. Data²ÎÓëÕß
±»Producer²ÎÓëÕßËù´´½¨£¬²¢ÓÉConsumer²ÎÓëÕßËùʹÓá£
2. Producer£¨Éú²úÕߣ©²ÎÓëÕß
´´½¨Data²ÎÓëÕߣ¬²¢½«Æä´«µÝ¸øChannel²ÎÓëÕß¡£
3. Consumer£¨Ïû·ÑÕߣ©²ÎÓëÕß
´ÓChannel²ÎÓëÕß»ñÈ¡Data²ÎÓëÕß¡ ......
×î³õÎÒÃÇÓà Java д JSP µÄʱºò£¬¼¸ºõ¿ÉÒÔ²»´¥¼°Òì³££¬ÒòΪ Servlet ÈÝÆ÷»á°Ñ API Å׳öµÄÒì³£°ü×°³É
ServletException ¶ª¸øÈÝÆ÷È¥´¦Àí¡£ÔÙºóÀ´Ó¦Ó÷ֲ㣬´úÂëÖÐÒª´¦ÀíµÄÒì³£±ã¶àÁË£¬Ò»°ã»áת»»³É×Ô¶¨ÒåµÄÒµÎñÒì³£À࣬ÓÃ
try-catch-throw
customerException-finally¡£ÔÙµ½Èç½ñ¸÷ÖÖ¿ò¼ÜÈÕÕé³ÉÊ죬´úÂëÖÐÏÔʽµÄÒì³£´¦ÀíÓÖ½¥ ......
ÖÚËùÖÜÖª£¬javaÖÐintÐͺÍcharÐÍÊý¾Ý²»ÏñcÓïÑÔÖÐÄÇÑù¿ÉÒÔÈÎÒâת»»£¬¼´²»¿ÉÒÔ½«Ò»¸öintÐͱäÁ¿×Ô¶¯×ª»»ÎªcharÐÍ£¬ÈçÏÂÃæ´úÂëÖеÄÑÝʾ:
public class TestSort{
public static void main(String args[]){
int x='a';//²»»á²úÉú±àÒë´íÎó£¬ÒòΪ'a'¸³¸øxÊÇÒþʽת»»
System.out.println(x);
&nb ......