public class Rep3{ public static void main(String args[]){ int a = Integer.valueOf(args[0]).intValue(); int b = Integer.valueOf(args[1]).intValue(); ......... } }int·¿ÊÑ¿ôa¤Ï½ÐÎϤ¹¤ë¿Þ·Á¤Èʸ»úÎó¤Î»ØÄê¤ò¤¹¤ë£±¤ÄÌܤΰú¿ô¤Ë¡¢b¤Ïʸ»úÎó¤ÎÈ¿Éü²ó¿ô¤Î»ØÄê¤Ë»ÈÍѤ¹¤ë£²¤ÄÌܤΰú¿ô¤È¤·¤Æ»ÈÍѤ¹¤ë¡£ ¤Ê¤ª¡¢¥³¥Þ¥ó¥É¥é¥¤¥ó¤Ë°ú¿ô¤òÆþÎϤ¹¤ëºÝ¤Ï¡¢£±¤ÄÌܤΰú¿ôÆþÎϸå¤Ë¥¹¥Ú¡¼¥¹ ¥¡¼¤òª¡²óÆþÎϤ·¤Æ¤«¤é£²¤ÄÌܤΰú¿ô¤òÆþÎϤ¹¤ë»ö¡£ÆþÎÏÎã¤Ï¤³¤Á¤é¡£
[Yuta-AKAMINE:~/Javaworks] j03002% java Exam 2 4 //'2'¤Ï¹àÌÜ»ØÄê¡¢'4'¤Ïʸ»úÎó¤Î¥ë¡¼¥×²ó¿ô Input number is => 2 The function your directed is this! The function your directed is this! The function your directed is this! The function your directed is this! loop count => 4
/*Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥ª¥ê¥¸¥Ê¥ëÌäÂê¡¢»î¸³²þÎÉÈÇ*/ public class Exam { public static void main(String args[]){ int a = Integer.valueOf(args[0]).intValue(); int b = Integer.valueOf(args[1]).intValue(); System.out.println("Input number is => " + a); switch (a) { case 1: Shape(); break; case 2: Sentence1(b); break; case 3: Sentence2(b); break; default: System.out.println("Please input number among 1,2,3"); break; } } public static void Shape() { for(int c=0;c<7;c++){ if( c==0 || c==6){ System.out.println(" * "); }else if( c==1 || c==5){ System.out.println(" *** "); }else if(c==2 || c==4){ System.out.println(" ***** "); }else if( c==3){ System.out.println("*******"); } } } public static void Sentence1(int b) { int k = 0; while( b > 0 ){ System.out.println("The function your directed is this!"); k++; b--; } System.out.println("loop count => " + k); } public static void Sentence2(int b) { int f = 0; for( int e=b;e>0; e--){ { f++; System.out.println("Kurikaesimasse!!"); } if(e!=1) continue; System.out.println("Loop count of first massage=> "+f); } System.out.println("Owarimasse!"); } }
[Yuta-AKAMINE:~/Javaworks] j03002% java Exam 1 0 Input number is => 1 * *** ***** ******* ***** *** * [Yuta-AKAMINE:~/Javaworks] j03002% java Exam 2 4 Input number is => 2 The function your directed is this! The function your directed is this! The function your directed is this! The function your directed is this! loop count => 4 [Yuta-AKAMINE:~/Javaworks] j03002% java Exam 3 5 Input number is => 3 Kurikaesimasse!! Kurikaesimasse!! Kurikaesimasse!! Kurikaesimasse!! Kurikaesimasse!! Loop count of first massage=> 5 Owarimasse! [Yuta-AKAMINE:~/Javaworks] j03002%
ºîÀ®¤·¤¿¥½¡¼¥¹¤ÎÁ°È¾°Ê³°¤ÏÁ´ÉôÁ°´ü¤Ë½¬¤Ã¤¿C¸À¸ì¤ÎÀ©¸æʸ¤ÈƱ¤¸Í×ÎΤÇ
ºî¤Ã¤¿¤Î¤Ç¡¢Æä˹ͻ¡¤·¤Æȯ¸«¤·¤¿Éôʬ¤È¸À¤¦¤Î¤Ï¤¢¤ê¤Þ¤»¤ó¤Ç¤·¤¿¤¬¡¢º£
¤Þ¤Ç³Ø½¬¤·¤Æ¤¤¿C¸À¸ì¤ÎÀ©¸æʸ¤ÎÉü½¬¤È¸À¤¦°ÕÌ£¹ç¤¤¤â¤«¤Í¤ÆÌäÂê¤òºî¤ê
¤Þ¤·¤¿¡£
¡ÖJava¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î½éµéÌäÂê¤òºî¤ë¡×¤È¸À¤¦»ö¤Ç¡¢¤É¤Î
ÄøÅ٤ޤǤι½Â¤¤òÍʤ¹¤ë¥½¡¼¥¹¤¬½éµé¼Ô¸þ¤±¤È¤Ê¤ë¤Î¤«¤¬È½ÃǤ·¤Å¤é¤«¤Ã¤¿
¤Î¤Ç¡¢¤È¤ê¤¢¤¨¤ºº£¤Î¼«Ê¬¤¬¡Ö»²¹Í½ñ¤ò¸«¤º¤Ëȯ°Æ½ÐÍè¤ë¤è¤¦¤Ê¡×¥½¡¼¥¹¤ò
ºî¤Ã¤Æ¤ß¤Þ¤·¤¿¡£¤Þ¤¢¡¢²òÅúÎã¤ÎºÇ½é¤Ë½Ð¤Æ¤¯¤ë¥³¥Þ¥ó¥É¥é¥¤¥ó¤«¤é¤ÎÀ°¿ô
¤Î°úÍѤϻ²¹Í½ñ¤ò¸«¤Æ»È¤¤¤Þ¤·¤¿¤¬¡£
try¤äcatch¡¢throw¤Ê¤ó¤«¤ÎÀ©¸æ
ʸ¤Ë¤â¼ê¤ò½Ð¤·¤Æ¤ß¤¿¤«¤Ã¤¿¤Î¤Ç¤¹¤¬¡¢¤¢¤¯¤Þ¤Ç¼«Ê¬¤ÎÃæ¤Ç¤Ï½éµéÌäÂê¤Ë¤³
¤À¤ï¤Ã¤Æ¤¤¤¿¤Î¤È¡¢¼ê¤ò½Ð¤·¤Æ¤ß¤¿¤â¤Î¤Î¸«»ö¤Ë¤¹¤Ù¤Ã¤Æ¤·¤Þ¤Ã¤¿¤È¤¤¤¦¤Î
¤â¤¢¤Ã¤¿¤Î¤Ç¡¢º£²ó¤Î²ÝÂê¤Ç¤Ï»È¤¤¤Þ¤»¤ó¤Ç¤·¤¿¡£
¤Þ¤À¤Þ¤À¼ºÇÔ¤ÎϢ³
¤Ç¤¹¤¬¡¢¤â¤Ã¤ÈÀº¿Ê¤·¤Æ¤¤¤¤¥½¡¼¥¹¤¬ÁȤá¤ë¤è¤¦¤Ë¤Ê¤ê¤¿¤¤¤Ç¤¹¡£
new ¤Ï¤ä¤ï¤«¤êJava °æÅľ»Ç· Ãø¡¡£±£¹£¹£·Ç¯¡¡¶¦Î©½ÐÈÇ
Java ¥¯¥¤¥Ã¥¯¥ê¥Õ¥¡¥ì¥ó¥¹(¥È¥éËÜ)