* Java ÄÄÆÄÀÏ·¯¸¦ ÀÌ¿ëÇÏ¿© Java ¿ø½Ã ÈÀÏÀ» ÄÄÆÄÀÏ ÇÑ´Ù.
UNIX:
javac HelloWorldApp.java
DOS shell (Windows 95/NT):
javac HelloWorldApp.java
ÄÄÆÄÀÏÀ» ¼º°øÀûÀ¸·Î ¸¶Ä¡¸é, HelloWorldApp.class¶ó´Â ÈÀÏÀ» »ý¼ºÇÑ´Ù.
Ȥ½Ã ÄÄÆÄÀÏÀÌ ¾ÈµÇ¸é ¿ÀŸ°¡ ÀÖ´ÂÁö È®ÀÎÇÑ´Ù.
* Java ÀÎÅÍÇÁ¸®Å͸¦ ÀÌ¿ëÇÏ¿© Java ÇÁ·Î±×·¥À» ½ÇÇà ½ÃŲ´Ù.
UNIX:
java HelloWorldApp
DOS shell (Windows 95/NT):
java HelloWorldApp
Java ÀÎÅÍÇÁ¸®ÅÍÀÇ ¾Æ±Ô¸ÕÆ®´Â *.java ÈÀÏÀ̸§ÀÌ ¾Æ´Ï¶ó, main()ÀÌ ÀÖ´Â
classÀ̸§ÀÌ´Ù. ½ÇÇàÀÌ µÇ¸é, Ç¥ÁØ Ãâ·Â(ȸé)À¸·Î "Hello World!"¶ó´Â
±ÛÀÚ°¡ º¸ÀÏ°ÍÀÌ´Ù.
0.2 "Hello World" ¿¡Çø´ (Applet).
* Java ¿ø½Ã ÈÀÏÀ» »ý¼ºÇÑ´Ù.
import java.awt.Graphics;
public class HelloWorld extends java.applet.Applet {
public void init() {
resize(150,25);
}
public void paint(Graphics g) {
g.drawString("Hello world!", 50, 25);
}
}
HTML µð·ºÅ丮¿¡ HelloWorld.java¶ó´Â ÈÀÏÀ» »ý¼ºÇÑ´Ù.
* Java ÄÄÆÄÀÏ·¯·Î Java ¿ø½ÃÈÀÏÀ» ÄÄÆÄÀÏ ÇÑ´Ù.
UNIX:
javac HelloWorld.java
DOS shell (Windows 95/NT):
javac HelloWorld.java
ÄÄÆÄÀÏÀ» ¼º°øÀûÀ¸·Î ¸¶Ä¡¸é, HelloWorldApp.class¶ó´Â ÈÀÏÀ» »ý¼ºÇÑ´Ù.
Ȥ½Ã ÄÄÆÄÀÏÀÌ ¾ÈµÇ¸é ¿ÀŸ°¡ ÀÖ´ÂÁö È®ÀÎÇÑ´Ù.
* ¾ÖÇø´À» Æ÷ÇÔÇÏ¿© ¼öÇà½Ãų HTMLÈÀÏÀ» »ý¼ºÇÑ´Ù.
<HTML>
<HEAD>
<TITLE> A Simple Program <TITLE>
<HEAD>
<BODY>
Here is the output of my program:
<APPLET CODE="HelloWorld.class" WIDTH=150 HEIGHT=25>
<APPLET>
<BODY>
<HTML>
HTML µð·ºÅ丮¿¡ Hello.htmlÀ̶ó´Â ÈÀÏ·Î ÀÛ¼ºÇÏ¿© ÀúÀåÇÑ´Ù.
* AppletViewer·Î ºÒ·¯¿Â´Ù.
AppletViewer¸¦ ÅëÇؼ »õ·Î »ý¼ºÇÑ HTMLµð·ºÅ丮¿¡ ÀÖ´Â ÈÀÏÀÇ URLÀ» Àû¾î¼
HTMLÈÀÏÀ» ºÒ·¯ µéÀδÙ.
appletviewer Hello.html
¼º°øÀûÀ¸·Î ¼öÇàµÈ´Ù¸é, À©µµ¿ì°¡ »õ·Ó°Ô »ý¼ºµÇ¸é¼ Hello World ¶ó´Â
¹®ÀÚ¸¦ º¼¼ö ÀÖÀ»°ÍÀÌ´Ù.