- アプリケーションは単体で動作するプログラム
- アプレットはwebブラウザなどの上で動作するプログラム
- Javaを使って作成したテキスト形式のプログラムをソースコードという
- ソースコードからコンパイルするとバイトコード形式のクラスファイルが得られる
- インタプリタ(java)によって、アプリケーションを実行できる
- アプレットビューアによってアプレットを実行できる
Last active
December 28, 2015 04:19
-
-
Save shigemk2/7441528 to your computer and use it in GitHub Desktop.
やさしいJava 活用編 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Sample1 | |
{ | |
public static void main(String[] args) | |
{ | |
System.out.println("ようこそアプリケーションへ!"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>サンプル</title> | |
</head> | |
<body> | |
<applet code = "Sample2.class" width = 200 height = 200> | |
</applet> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
public class Sample2 extends JApplet | |
{ | |
private JLabel lb; | |
public void init() | |
{ | |
lb = new JLabel(); | |
lb.setText("ようこそアプレットへ!"); | |
add(lb); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleP1 | |
{ | |
public static void main(String[] args) | |
{ | |
System.out.println("こんにちは"); | |
System.out.println("さようなら"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>サンプル</title> | |
</head> | |
<body> | |
<applet code = "Sample2.class" width = 300 height = 300> | |
</applet> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
public class SampleP2 extends JApplet | |
{ | |
private JLabel lb; | |
public void init() | |
{ | |
lb = new JLabel(); | |
lb.setText("ようこそアプレットへ!"); | |
add(lb); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment