1. Javaã®åºæ¬ãšã¯
ããã°ã©ãã³ã°ã®äžçã«ã¯å€ãã®èšèªãååšããŸããããã®äžã§ãJavaã¯ç¹ã«æ³šç®ãããååšãšãªã£ãŠããŸããã§ã¯ãJavaãšã¯äžäœäœãªã®ã§ããããããã®ã»ã¯ã·ã§ã³ã§ã¯ãJavaã®æŽå²ãèæ¯ãç¹åŸŽããããŠããŒãžã§ã³ã®é²åã«ã€ããŠè©³ãã解説ããŸãã
1.1 Javaã®æŽå²ãšèæ¯
Javaã¯ã1990幎代åé ã«Sun Microsystemsã«ãã£ãŠéçºãããŸãããåœåã®ç®çã¯ã家é»è£œåãå¶åŸ¡ããããã®ããã°ã©ã ãäœæããããšã§ããããããããã®åŸã®ã€ã³ã¿ãŒãããã®ççºçãªæ®åãšãšãã«ãJavaã¯ãŠã§ãã¢ããªã±ãŒã·ã§ã³ã®éçºèšèªãšããŠã®å°äœã確ç«ããŸããã
Javaã®ååã®ç±æ¥ã¯ãéçºè ãã¡ãã³ãŒããŒã飲ã¿ãªããè°è«ãéããããšãããã³ãŒããŒã®ç£å°ã§ãããJava島ãã«ã¡ãªãã§åä»ããããŸããã
1.2 Javaã®ç¹åŸŽãšäž»ãªçšé
Javaã®æ倧ã®ç¹åŸŽã¯ããäžåºŠæžãã°ã©ãã§ãåãããšããã³ã³ã»ããã«ãããŸããããã¯ãJavaã§æžãããããã°ã©ã ã¯ãç°ãªãã³ã³ãã¥ãŒã¿ãããã€ã¹äžã§ãåäœãããšããæå³ã§ãããã®ç¹æ§ã¯ãJavaã®ä»®æ³ãã·ã³ãšããæè¡ã«ãã£ãŠå®çŸãããŠããŸãã
ãŸããJavaã¯ãªããžã§ã¯ãæååã®ããã°ã©ãã³ã°èšèªã§ãããããã«ãããããã°ã©ã ã®åå©çšæ§ãæ¡åŒµæ§ãé«ãŸããŸããäž»ãªçšéãšããŠã¯ããŠã§ãã¢ããªã±ãŒã·ã§ã³ã®éçºãã¹ããŒããã©ã³ã¢ããªã®å¶äœãããã«ã¯çµã¿èŸŒã¿ã·ã¹ãã ã®éçºãªã©ãå¹ åºãåéã§å©çšãããŠããŸãã
1.3 Javaã®ããŒãžã§ã³ãšãã®é²å
Javaã¯ããã®ç»å Žä»¥æ¥ãæ°å€ãã®ããŒãžã§ã³ã¢ãããéããŠããŸãããåããŠå ¬éãããJava 1.0ãããçŸåšã®ææ°ããŒãžã§ã³ãŸã§ããã®éœåºŠæ°ããæ©èœãè¿œå ãããæ§èœãåäžããŠããŸãã
ç¹ã«æ³šç®ãã¹ãã¯ãJava 8ã§å°å ¥ãããã©ã ãåŒããJava 9ã§ã®ã¢ãžã¥ãŒã«ã·ã¹ãã ã®å°å ¥ãªã©ãããã°ã©ãã®çç£æ§ãåäžãããããã®æ©èœãå€æ°è¿œå ãããŠããŸãã
Javaã®ããŒãžã§ã³ããšã®é²åãç¥ãããšã§ããã®æ代ã®æè¡ãã¬ã³ããããŒãºãç解ããæå©ããšãªããŸãã
2. Javaã§ã§ããããšã®é å
Javaã¯ããã®å€æ©èœæ§ãšæ¡åŒµæ§ãããå€ãã®éçºè ã«æ¯æãããŠããŸãããã®ã»ã¯ã·ã§ã³ã§ã¯ãJavaãæã€é åçãªç¹æ§ãæ©èœã«ã€ããŠãå ·äœçãªäŸã亀ããŠè©³ãã解説ããŸãã
2.1 ã¯ãã¹ãã©ãããã©ãŒã ã®éçº
Javaã®æã泚ç®ãã¹ãç¹æ§ã®äžã€ã¯ãã¯ãã¹ãã©ãããã©ãŒã ã®éçºãå¯èœã§ããããšã§ããããã¯ãJavaã§æžãããã¢ããªã±ãŒã·ã§ã³ããWindowsãMacãLinuxãªã©ãç°ãªããªãã¬ãŒãã£ã³ã°ã·ã¹ãã äžã§åäœããããšãæå³ããŸãããã®ç¹æ§ã¯ãJavaã®ä»®æ³ãã·ã³ãšããæè¡ã«ãã£ãŠå®çŸãããŠãããéçºè ã¯äžåºŠã®ã³ãŒãã£ã³ã°ã§å€æ§ãªç°å¢ã«å¯Ÿå¿ããã¢ããªã±ãŒã·ã§ã³ãäœæããããšãã§ããŸãã
2.2 è±å¯ãªã©ã€ãã©ãªãšãã¬ãŒã ã¯ãŒã¯
Javaã¯ããã®é·ãæŽå²ãšå ±ã«ãå€ãã®ã©ã€ãã©ãªããã¬ãŒã ã¯ãŒã¯ãéçºãããŠããŸããããããã¯ãç¹å®ã®æ©èœãã¿ã¹ã¯ãç°¡åã«å®è£ ããããã®ããŒã«ãšããŠå©çšããããã®ã§ãäŸãã°ããŒã¿ããŒã¹ã®æäœããŠã§ãã¢ããªã±ãŒã·ã§ã³ã®éçºãªã©ãæ§ã ãªçšéã§æŽ»çšãããŠããŸããããã«ãããéçºè ã¯è€éãªã³ãŒããäžããæžãå¿ èŠããªããå¹ççã«ãããžã§ã¯ããé²ããããšãã§ããŸãã
2.3 ã»ãã¥ãªãã£ãšããã©ãŒãã³ã¹
Javaã¯ãã»ãã¥ãªãã£ãšããã©ãŒãã³ã¹ã®é¢ã§ãé«ãè©äŸ¡ãåããŠããŸããJavaã®ã»ãã¥ãªãã£æ©èœã¯ãäžæ£ãªã¢ã¯ã»ã¹ãæ»æããã·ã¹ãã ãå®ãããã®ãã®ã§ãäŸãã°ãµã³ãããã¯ã¹ãšããæè¡ãå©çšããŠãäžæ£ãªã³ãŒãã®å®è¡ãé²ãä»çµã¿ããããŸãã
ãŸããJavaã®ããã©ãŒãã³ã¹ã¯ãJITã³ã³ãã€ã©ãã¬ããŒãžã³ã¬ã¯ã·ã§ã³ãšãã£ãæè¡ã«ãã£ãŠãé«éãªåäœãå®çŸãããŠããŸããç¹ã«ã倧èŠæš¡ãªã·ã¹ãã ãã¢ããªã±ãŒã·ã§ã³ã®éçºã«ãããŠãJavaã®é«ãããã©ãŒãã³ã¹ã¯å€§ããªã¢ããã³ããŒãžãšãªããŸãã
3. Javaã®å®çšäŸ
Javaã¯ãã®æ±çšæ§ãšé«ãããã©ãŒãã³ã¹ãããããŸããŸãªåéã§ã®éçºã«å©çšãããŠããŸãããã®ã»ã¯ã·ã§ã³ã§ã¯ãJavaãã©ã®ãããªå Žé¢ã§æŽ»èºããŠããã®ããå ·äœçãªå®çšäŸãéããŠè©³ãã解説ããŸãã
3.1 ãŠã§ãã¢ããªã±ãŒã·ã§ã³ã®éçº
Javaã¯ããŠã§ãã¢ããªã±ãŒã·ã§ã³ã®éçºã«åºãå©çšãããŠããŸããç¹ã«ããµãŒããŒãµã€ãã®éçºã«ãããŠãJavaã®ãã¬ãŒã ã¯ãŒã¯ã§ããSpringãJava EEã人æ°ãéããŠããŸãããããã®ãã¬ãŒã ã¯ãŒã¯ã䜿çšããããšã§ãããŒã¿ããŒã¹ã®æäœãã»ãã¥ãªãã£å¯ŸçããŠãŒã¶ãŒèªèšŒãªã©ããŠã§ãã¢ããªã±ãŒã·ã§ã³éçºã«å¿ èŠãªæ©èœãå¹ççã«å®è£ ããããšãã§ããŸãã
3.2 ã¹ããŒããã©ã³ã¢ããªã®å¶äœ
ã¹ããŒããã©ã³ã®æ®åã«äŒŽããJavaã¯Androidã¢ããªã®éçºèšèªãšããŠã泚ç®ãããŠããŸããAndroidã®å ¬åŒéçºç°å¢ã§ããAndroid Studioã䜿çšããããšã§ãJavaãåºç€ãšããã¢ããªã±ãŒã·ã§ã³ãç°¡åã«å¶äœããããšãã§ããŸãããŸããJavaã§æžãããã³ãŒãã¯ãç°ãªãããã€ã¹ãç»é¢ãµã€ãºã«ãæè»ã«å¯Ÿå¿ããããšãå¯èœã§ãã
3.3 ã²ãŒã ããšã³ã¿ãŒãã€ã³ã¡ã³ã
Javaã¯ãã²ãŒã ããšã³ã¿ãŒãã€ã³ã¡ã³ãåéã§ãå©çšãããŠããŸããç¹ã«ããã©ãŠã¶äžã§åäœããã²ãŒã ãã3Dã°ã©ãã£ãã¯ã¹ãå©çšãããšã³ã¿ãŒãã€ã³ã¡ã³ãã³ã³ãã³ãã®å¶äœã«ã¯ãJavaã®ã©ã€ãã©ãªãAPIã掻çšãããŠããŸããããã«ããããŠãŒã¶ãŒã¯è¿œå ã®ãœãããŠã§ã¢ãã€ã³ã¹ããŒã«ããããšãªãããªã¢ã«ã¿ã€ã ã§ã®ãšã³ã¿ãŒãã€ã³ã¡ã³ãã楜ããããšãã§ããŸãã
3.4 äŒæ¥åãã·ã¹ãã ã®æ§ç¯
å€ãã®å€§æäŒæ¥ãçµç¹ã¯ãæ¥åãå¹çåããããã®ã·ã¹ãã ãæã£ãŠããŸããJavaã¯ããã®é«ãã»ãã¥ãªãã£ãšã¹ã±ãŒã©ããªãã£ããããããã®äŒæ¥åãã·ã¹ãã ã®æ§ç¯ã«ãéžã°ããŠããŸããäŸãã°ãåšåº«ç®¡çã顧客æ å ±ã®ç®¡çã販売ããŒã¿ã®åæãªã©ãæ§ã ãªæ¥åããã»ã¹ãJavaãçšããŠæé©åããããšãã§ããŸãã
4. Javaã®ããã°ã©ãã³ã°å ¥é
Javaã¯ãåå¿è ã«ãåŠã³ãããããã°ã©ãã³ã°èšèªãšããŠç¥ãããŠããŸãããã®ã»ã¯ã·ã§ã³ã§ã¯ãJavaã®ããã°ã©ãã³ã°ãå§ããããã®åºæ¬çãªã¹ããããç¥èã«ã€ããŠãé ãè¿œã£ãŠè§£èª¬ããŸãã
4.1 Javaã®éçºç°å¢ã®ã»ããã¢ãã
Javaã®ããã°ã©ãã³ã°ãå§ããåã«ããŸãã¯éçºç°å¢ãæŽããå¿ èŠããããŸããJavaã®å ¬åŒãµã€ãããJava Development Kit (JDK)ãããŠã³ããŒãããã€ã³ã¹ããŒã«ããŸããJDKã«ã¯ãJavaã®ã³ã³ãã€ã©ãå®è¡ç°å¢ãªã©ãããã°ã©ãã³ã°ã«å¿ èŠãªããŒã«ãå«ãŸããŠããŸãããŸããããã¹ããšãã£ã¿ãçµ±åéçºç°å¢ïŒIDEïŒã®å°å ¥ãããããããŸããç¹ã«ãEclipseãIntelliJ IDEAãšãã£ãIDEã¯ãJavaã®ã³ãŒãã®èšè¿°ããããã°ãå¹ççã«è¡ãããšãã§ããŸãã
4.2 æåã®Javaããã°ã©ã ãæžãã
éçºç°å¢ãæŽã£ãããæåã®Javaããã°ã©ã ãæžããŠã¿ãŸãããã以äžã¯ãç»é¢ã«ãHello, World!ããšè¡šç€ºããã·ã³ãã«ãªJavaããã°ã©ã ã®äŸã§ãã
“`java
public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello, World!”);
}
}
ãã®ã³ãŒããããã¹ããšãã£ã¿ãIDEã«å ¥åãããã¡ã€ã«åããHelloWorld.javaããšããŠä¿åããŸãããã®åŸãã³ãã³ãããã³ãããã¿ãŒããã«ãéããJavaã®ã³ã³ãã€ã©ã䜿çšããŠããã°ã©ã ãã³ã³ãã€ã«ããå®è¡ããŸãã
4.3 åºæ¬çãªææ³ãšã³ã³ã»ãã
Javaã®ããã°ã©ãã³ã°ã«ã¯ãããã€ãã®åºæ¬çãªææ³ãã³ã³ã»ãããç解ããå¿ èŠããããŸããäŸãã°ãå€æ°ã¯ããŒã¿ãæ ŒçŽããããã®ãã®ã§ãããŒã¿åã«å¿ããŠæŽæ°ãæååãªã©ã®å€ãä¿æããŸãããŸããå¶åŸ¡æã䜿çšããããšã§ãããã°ã©ã ã®å®è¡ãããŒãå¶åŸ¡ããããšãã§ããŸããããã«ã¯ãæ¡ä»¶åå²ã®ãifæããç¹°ãè¿ãã®ãforæããªã©ããããŸããããã«ãã¡ãœããã¯ãç¹å®ã®åŠçããŸãšããŠå®çŸ©ããããã®ãã®ã§ãããã°ã©ã ã®æ§é ãæŽçããåå©çšæ§ãé«ãã圹å²ããããŸãã
ãããã®åºæ¬çãªææ³ãã³ã³ã»ãããç解ããããšã§ãããè€éãªããã°ã©ã ã®éçºããä»ã®ããã°ã©ãã³ã°èšèªã®åŠç¿ã«ã圹ç«ã¡ãŸãã
5. Javaã§ã®ãããžã§ã¯ãã®é²ãæ¹
Javaã䜿çšãããããžã§ã¯ããæåãããããã«ã¯ãèšç»çãªã¢ãããŒããšäžé£ã®ãã¹ããã©ã¯ãã£ã¹ãäžå¯æ¬ ã§ãããã®ã»ã¯ã·ã§ã³ã§ã¯ãJavaãããžã§ã¯ãã®å¹æçãªé²ãæ¹ã«ã€ããŠè§£èª¬ããŸãã
5.1 ãããžã§ã¯ãã®èšç»ãšèšèš
ãããžã§ã¯ãã®éå§åã«ãç®çãšç®æšãæ確ã«å®çŸ©ããããšãéèŠã§ãã次ã«ãã·ã¹ãã ã®å šäœçãªã¢ãŒããã¯ãã£ãæ©èœèŠä»¶ãèšèšããŸãããã®æ®µéã§ã®è©³çŽ°ãªèšèšã¯ãåŸã®éçºãã§ãŒãºã§ã®äœæ¥ãã¹ã ãŒãºã«é²ããããã®åå°ãšãªããŸãã
5.2 ã³ãŒãã£ã³ã°ãšãã¹ãã®ãã¹ããã©ã¯ãã£ã¹
Javaã§ã®ã³ãŒãã£ã³ã°ã«ã¯ãäžè²«æ§ã®ããã³ãŒãã£ã³ã°ã¹ã¿ã€ã«ãåœåèŠåã®é©çšãæšå¥šãããŸãããŸããåäœãã¹ããçµ±åãã¹ããå®æçã«å®æœããããšã§ãã³ãŒãã®å質ãç¶æã»åäžãããããšãã§ããŸãããã¹ãé§åéçº(TDD)ã®ãããªã¢ãããŒããåãå ¥ããããšããå質ã®é«ãã³ãŒããæžãããã®äžã€ã®æ¹æ³ã§ãã
5.3 ãããã°ãšãã©ãã«ã·ã¥ãŒãã£ã³ã°
ããã°ã©ã ã«ã¯å¿ ããšèšã£ãŠããã»ã©ãã°ãçºçããŸããJavaã«ã¯ããããã¬ããã°åºåããŒã«ãªã©ããã°ã®åå ãç¹å®ãä¿®æ£ããããã®å€ãã®ããŒã«ãæäŸãããŠããŸãããããã®ããŒã«ãå¹æçã«äœ¿çšããããšã§ãåé¡ã®ç¹å®ãšä¿®æ£ãè¿ éã«è¡ããŸãã
以äžã®ã¹ããããéµå®ããããšã§ãJavaã䜿çšãããããžã§ã¯ããå¹æçã«é²ããããšãã§ããŸããåããŠã®ãããžã§ã¯ãã§ããèšç»çã«ã¢ãããŒãããããšã§ãæåãžã®éãåãéãããšãã§ããã§ãããã
6. ä»åŸã®Javaã®å±æ
Javaã¯ããã®èªçããçŸåšã«ãããŠå€ãã®å€é·ãçµãŠããŸããããããããã®äººæ°ã¯è¡°ããããšãªããä»ãå€ãã®éçºè ã«æ¯æãããŠããŸãããã®ã»ã¯ã·ã§ã³ã§ã¯ãJavaã®æªæ¥ã«ã€ããŠèå¯ããŸãã
6.1 Javaã®ææ°ãã¬ã³ã
è¿å¹ŽãJavaã¯ã¯ã©ãŠãã³ã³ãã¥ãŒãã£ã³ã°ããã€ã¯ããµãŒãã¹ã®åéã§ã®å©çšãå¢ããŠããŸããç¹ã«ãã³ã³ããæè¡ãšã®é£æºã匷åãããJavaã¢ããªã±ãŒã·ã§ã³ã®ãããã€ãããç°¡åã«ãªã£ãŠããŸãããŸããJavaã®æ°ããããŒãžã§ã³ã§ã¯ãããã©ãŒãã³ã¹ã®åäžãæ°ããæ©èœãç¶ç¶çã«è¿œå ãããŠãããéçºè ã¯åžžã«ææ°ã®æè¡ãã¬ã³ããåãå ¥ããããšãã§ããŸãã
6.2 Javaãšä»ã®ããã°ã©ãã³ã°èšèªãšã®æ¯èŒ
Javaã¯ããã®å®å®æ§ãããŒã¿ããªãã£ããå€ãã®äŒæ¥ã§æ¡çšãããŠããŸããããããPythonãJavaScriptãªã©ã®èšèªã人æ°ããããŸããJavaã®åŒ·ã¿ã¯ãã¯ãã¹ãã©ãããã©ãŒã ã§ã®åäœããè±å¯ãªã©ã€ãã©ãªãšãã¬ãŒã ã¯ãŒã¯ã«ãããŸããäžæ¹ãä»ã®èšèªã¯ããŒã¿ãµã€ãšã³ã¹ãããã³ããšã³ãéçºãªã©ãç¹å®ã®çšéã§ã®åŒ·ã¿ãæã£ãŠããŸãã
6.3 Javaã®ã³ãã¥ããã£ãšãªãœãŒã¹
Javaã®å€§ããªé åã®äžã€ã¯ã掻çºãªã³ãã¥ããã£ãšè±å¯ãªãªãœãŒã¹ã§ããå€ãã®éçºè ãJavaé¢é£ã®æ å ±ãå ±æããŠãããåå¿è ããçµéšè ãŸã§ãåŠã³ãæ å ±äº€æãè¡ãããšãã§ããŸãããŸãããªã³ã©ã€ã³äžã«ã¯Javaã®ãã¥ãŒããªã¢ã«ãããã¥ã¡ã³ããæ°å€ãååšããåŠç¿ãªãœãŒã¹ãšããŠå©çšããããšãã§ããŸãã
Javaã¯ããããããæè¡ã®é²åãšãšãã«æé·ããŠããèšèªã§ããããšã¯ééããããŸããããã®èæ¯ã«ã¯ã匷åãªã³ãã¥ããã£ã®ãµããŒããšãç¶ç¶çãªæè¡ã®æŽæ°ããããŸãã
7. ãŸãšã
ãã®èšäºãéããŠãJavaã®åºæ¬ããææ°ã®ãã¬ã³ããå®çšäŸãå ¥éæ¹æ³ããããžã§ã¯ãã®é²ãæ¹ããããŠä»åŸã®å±æãŸã§ãå¹ åºãJavaã«ã€ããŠåŠã¶ããšãã§ããŸãããJavaã¯ãã¯ãã¹ãã©ãããã©ãŒã ã§åäœããå ç¢ãªããã°ã©ãã³ã°èšèªãšããŠãå€ãã®éçºè ãäŒæ¥ã«æ¯æãããŠããŸãã
Javaã®æ倧ã®é åã¯ããã®æ±çšæ§ãšæ¡åŒµæ§ã§ãããŠã§ãã¢ããªã±ãŒã·ã§ã³ããã¹ããŒããã©ã³ã¢ããªãã²ãŒã ãäŒæ¥åãã·ã¹ãã ãŸã§ãããŸããŸãªçšéã§Javaã¯æŽ»èºããŠããŸãããŸããJavaã®ã³ãã¥ããã£ã¯éåžžã«æŽ»çºã§ãæ°ããæè¡ããã¬ã³ãã次ã ãšçãŸããŠããŸãã
JavaãåŠã¶ããšã§ãææ°ã®æè¡ãã¬ã³ããåãå ¥ããéçºãå¯èœãšãªããããé«å質ãªãœãããŠã§ã¢ãæäŸããããšãã§ããŸãããŸããJavaã®ç¥èã¯ãä»ã®ããã°ã©ãã³ã°èšèªãåŠã¶éã®åºç€ãšããŠã圹ç«ã¡ãŸãã
æåŸã«ãJavaã¯é²åãç¶ããèšèªã§ãããããåžžã«ææ°ã®æ å ±ããã£ããã¢ããããã¹ãã«ã磚ãç¶ããããšãéèŠã§ãããããããJavaã®äžçã¯ããããªãçºå±ãéããŠããããšã§ãããã