HTML5¼¼Êõ

¾ÅÌìѧ»áJava£¬µÚÈýÌ죬ѡÔñ½á¹¹ - ¿­ÍþµÄ½²ÌÃ

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-09-01 11:00 ÎÒÒªÆÀÂÛ( )

¾ÅÌìѧ»áJava£¬µÚÈýÌ죬ѡÔñ½á¹¹ Ñ¡Ôñ½á¹¹ ÉÏÒ»½Ú½éÉÜÁËJavaµÄËãÊõÔËË㣬Èç¼Ó¼õ³Ë³ýµÈ£¬JavaµÄÔËËã¹æÔò¸úËÄÔòÔËËãÒ»Ñù¡£Õâ½ÚÎÒÃǽéÉÜÑ¡Ôñ½á¹¹ Ò»°ãÀ´Ëµ³ÌÐòÓÐÈýÖֽṹ£º ³ÌÐòÖÁÉ϶øÏÂÖðÐÐÖ´ÐУ¬Ò»ÌõÓï¾äÖ´ÐÐÍêÖ®ºó¼ÌÐøÖ´ÐÐÏÂÒ»ÌõÓï¾ä£¬ÈçÏÂͼËùʾ£º Ñ¡Ôñ½á¹¹

¾ÅÌìѧ»áJava£¬µÚÈýÌ죬ѡÔñ½á¹¹

Ñ¡Ôñ½á¹¹

ÉÏÒ»½Ú½éÉÜÁËJavaµÄËãÊõÔËË㣬Èç¼Ó¼õ³Ë³ýµÈ£¬JavaµÄÔËËã¹æÔò¸úËÄÔòÔËËãÒ»Ñù¡£Õâ½ÚÎÒÃǽéÉÜÑ¡Ôñ½á¹¹

Ò»°ãÀ´Ëµ³ÌÐòÓÐÈýÖֽṹ£º

³ÌÐòÖÁÉ϶øÏÂÖðÐÐÖ´ÐУ¬Ò»ÌõÓï¾äÖ´ÐÐÍêÖ®ºó¼ÌÐøÖ´ÐÐÏÂÒ»ÌõÓï¾ä£¬ÈçÏÂͼËùʾ£º

image

Ñ¡Ôñ½á¹¹ÊǸù¾ÝÌõ¼þµÄ³ÉÁ¢Óë·ñ£¬ÔÙ¾ö¶¨ÒªÖ´ÐÐÄÄЩÓï¾äµÄÒ»Öֽṹ¡£Èç¹ûÎÒû¼Ç´í£¬ÏÖÔÚÖÐѧ½×¶Î¶¼»áѧ¼òµ¥µÄÁ÷³Ìͼ¡£

case1

ÏÈ¿´×î³£¼ûµÄÑ¡Ôñ½á¹¹£¬Èç¹ûÅжÏÌõ¼þ³ÉÁ¢£¬Ö´ÐÐÓï¾ä1£¬Ö´ÐÐÍêÓï¾ä1Ö®ºóµ½Óï¾ä3.Èç¹ûÅжÏÌõ¼þ²»³ÉÁ¢£¬Ö´ÐÐÓï¾ä2£¬Ö´ÐÐÍêÓï¾ä2Ö®ºóÖ´ÐÐÓï¾ä3.

if (ÅжÏÌõ¼þ) { Óï¾ä1; } else { Óï¾ä2; } Óï¾ä3

image

case2

»¹ÓÐÒ»ÖÖ³£¼ûµÄÑ¡Ôñ½á¹¹£¬Èç¹ûÅжÏÌõ¼þ³ÉÁ¢£¬ÔòÖ´ÐÐÖ÷ÌåÓï¾ä¡£Ö´ÐÐÍêÖ÷ÌåÓï¾äÖ®ºóÖ´ÐÐÆäËûÓï¾ä¡£

if (ÅжÏÌõ¼þ) { Ö÷ÌåÓï¾ä; } ÆäËûÓï¾ä

image

/** * ±¾Àý×Ó½²½âÑ¡Ôñ½á¹¹ * ͬʱҲ»Ø¹Ë֮ǰµÄ֪ʶµã */ public class ThirdLesson { public static void main(String[] args) { /** * н¨Ò»¸ö¸¡µãÐͱäÁ¿£¬Ãû×Ö½Ðscore£¬70.1fÊÇ70.1¸¡µãÊýµÄÒâ˼ * °Ñ70.1¸³Öµ¸øscore * Ò»°ãÈí¼þÀscoreÊÇ´ÓÍⲿÊäÈë½øÀ´µÄ£¬±ÈÈçÀÏʦÊäÈëÄãµÄ·ÖÊý */ float score = 70.1f; /** * Èç¹ûscore ´óÓÚµÈÓÚ60£¬ÔòÖ´ÐÐ System.out.println("You have passed the exam"); * È»ºóÖ´ÐÐSystem.out.println("³ÌÐò¼ÌÐø"); * * Èç¹ûscore СÓÚ60£¬ÔòÖ´ÐÐSystem.out.println("You have failed the exam"); * È»ºóÖ´ÐÐSystem.out.println("³ÌÐò¼ÌÐø"); * * Çë¶ÔÕÕcase1ÀïµÄÁ÷³Ìͼ˼¿¼ */ if (score >= 60) { System.out.println("You have passed the exam"); } else { System.out.println("You have failed the exam"); } System.out.println("³ÌÐò¼ÌÐø"); /** * Ð޸ıäÁ¿scoreµÄÖµ * °Ñ100¸³Öµ¸øscore */ score = 100f; /** * Èç¹ûscore > 99,ÔòÖ´ÐÐSystem.out.println("ÎҲݣ¬Ñ§°Ô°¡"); * È»ºóÖ´ÐÐSystem.out.println("±¾Ê¾Àý½áÊø"); * * Çë¶ÔÕÕcase2ÀïµÄÁ÷³Ìͼ˼¿¼ */ if (score > 99) { System.out.println("ÎҲݣ¬Ñ§°Ô°¡"); } System.out.println("±¾Ê¾Àý½áÊø"); } } case3

case3ÊDZȽϸ´ÔÓµÄif elseif ½á¹¹

if (ÅжÏÌõ¼þ1) { Ö÷ÌåÓï¾ä1; } else if (ÅжÏÌõ¼þ2) { Ö÷ÌåÓï¾ä2; } else if (ÅжÏÌõ¼þ3) { Ö÷ÌåÓï¾ä3; } else { Ö÷ÌåÓï¾ä4 }

˳×ÅÇ°ÃæµÄ½²½â£¬ÎÒÃÇÊÔ×Åͨ¹ýÒ»¸öÀý×Ó˵Ã÷if elseif µÄÓ÷¨¡£

score = 80f; if (score >= 100 /*ÅжÏÌõ¼þ1*/) { System.out.println("¹þ¹þ£¬Ñ§°Ôѽ"); /*Ö´ÐÐÓï¾ä1*/ } else if (score >= 95 /*ÅжÏÌõ¼þ2*/) { System.out.println("ÓгÉΪѧ°ÔµÄDZÖÊ"); /*Ö´ÐÐÓï¾ä2*/ } else if (score >= 90 /*ÅжÏÌõ¼þ3*/) { System.out.println("С»ï¿Éν֮ÓÅÐã"); /*Ö´ÐÐÓï¾ä3*/ } else if (score >= 80 /*ÅжÏÌõ¼þ4*/) { System.out.println("С»ï³É¼¨»¹²»´í£¬ÓÅÁ¼"); /*Ö´ÐÐÓï¾ä4*/ } else if (score >= 60 /*ÅжÏÌõ¼þ5*/) { System.out.println("С»ï¼°¸ñÁË"); /*Ö´ÐÐÓï¾ä5*/ } else { System.out.println("²»µ½60·Ö£¬ÄãËûß÷¶ºÎÒÄØ"); /** Ö´ÐÐÓï¾ä6 **/ } /** ¼ÌÐøÖ´ÐÐ **/

Õâ¸öÀý×ÓÓ¦¸Ã»áÊä³ö/Ö´ÐÐÓï¾ä4/µÄ"С»ï³É¼¨»¹²»´í£¬ÓÅÁ¼"
Èç¹û°Ñscore=80f,¸Ä³Éscore=95f.»áÊä³ö /Ö´ÐÐÓï¾ä2/ µÄ"ÓгÉΪѧ°ÔµÄDZÖÊ"¡£
ËùÒÔÕû¸öÂß¼­ÊÇÏÈÅÐ¶Ï /ÅжÏÌõ¼þ1/ ³É²»³ÉÁ¢£¬Èç¹û³ÉÁ¢ÔòÖ´ÐÐ /Ö´ÐÐÓï¾ä1/ ¡£ ·ñÔò£¬ÅжÏ/ÅжÏÌõ¼þ2/£¬
Èç¹û³ÉÁ¢£¬ÔòÖ´ÐÐ /Ö´ÐÐÓï¾ä2/¡£ ÓÃÂß¼­Í¼À´ËµÃ÷¾ÍÊÇ£º

image

×ܽá
  • Ñ¡Ôñ½á¹¹Ê¹ÓÃif elseÓï·¨£¬»òÕßµ¥¶ÀʹÓÃif
  • if(){} else if {} else if{} else {} ±í´ïÁË£¬Èç¹û£¬·ñÔò£¬·ñÔò£¬·ñÔò...
  • ×÷Òµ

    (ͬʱ»Ø¹ËÇ°Á½½ÚµÄÄÚÈÝ)

  • ¶¨ÒåÒ»¸öint±äÁ¿£¬¸ø¶¨Ò»¸öÖµ£¬±ÈÈçÊÇ7£¬³ÌÐòÊä³ö¸ÃÖµÊÇ¡°Å¼Êý¡±»¹ÊÇ¡°ÆæÊý¡±
  • ¶¨ÒåÈý¸ödouble±äÁ¿£¬±ÈÈçdouble chinese = 85f, double math = 80f...;ÖµÔÚ³õʼ»¯Ê±¸ø¶¨£¬Ð´³ÌÐò¼ÆËãÈýÃųɼ¨µÄƽ¾ù·Ö£¬Èç¹ûƽ¾ù´óÓÚ60·Ö£¬Êä³ö¼°¸ñ£¬Èç¹û´óÓÚ80·ÖÊä³öÓÅÁ¼£¬´óÓÚ90·ÖÊä³öÓÅÐ㣬·ñÔò¾ÍÊä³ö²»¼°¸ñ
  • ÍêÕûÕ½Ú

    posted @

    ¡¡

    1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

    Ïà¹ØÎÄÕÂ
    • HTML5+jsÒ³Ãæ´«Öµ¸øJavaºǫ́µÄС¼¼ÇÉ - MLÒ¹Éñ

      HTML5+jsÒ³Ãæ´«Öµ¸øJavaºǫ́µÄС¼¼ÇÉ - MLÒ¹Éñ

      2017-08-25 17:00

    • µ¥ÎļþÎļþÉÏ´«µ½·þÎñÆ÷£¨HTML5+js+Java£© - MLÒ¹Éñ

      µ¥ÎļþÎļþÉÏ´«µ½·þÎñÆ÷£¨HTML5+js+Java£© - MLÒ¹Éñ

      2017-08-20 08:00

    • ¡¾javascript¡¿º¯ÊýÖеÄthisµÄËÄÖÖ°ó¶¨ÐÎʽ ¡ª ´ó¼Ò×¼±¸ºÃ¹Ï×Ó£¬ÎÒÒª½²¹ÊÊÂÀ²~~ - ÍâÆŵÄÅíºþÍå

      ¡¾javascript¡¿º¯ÊýÖеÄthisµÄËÄÖÖ°ó¶¨ÐÎʽ ¡ª ´ó¼Ò×¼±¸ºÃ¹Ï×Ó£¬ÎÒÒª

      2017-08-16 11:00

    • ¡¾javascript¡¿Ïê½âjavaScriptµÄÉ±´ - ÍâÆŵÄÅíºþÍå

      ¡¾javascript¡¿Ïê½âjavaScriptµÄÉ±´ - ÍâÆŵÄÅíºþÍå

      2017-08-15 12:01

    ÍøÓѵãÆÀ
    ²