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
/* | |
application 程式架構 | |
*/ | |
//package區 :定義此成是屬於哪個package | |
// :一定在程式的一開始,一個程式只能有一個package | |
//import區 | |
//import java.lang.*; | |
//import java.awt.*; |
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
/* | |
* 第一個Java程式 | |
*/ | |
public class Ex02_001 { | |
public static void main(String args[]){ | |
String string; |
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 java.io.*; | |
public class Ex03_101 { | |
public static void main(String args[]) throws IOException{ | |
// 宣告字串變數 | |
String ans ; | |
// 輸出說明 | |
System.out.printf("請輸入成績\n"); |
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 java.io.*; | |
public class Ex03_103 { | |
public static void main(String args[]) throws IOException { | |
// 宣告字串變數 | |
String ans; | |
// 輸出說明 | |
System.out.printf("請輸入成績\n"); |
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 java.io.*; | |
public class Ex03_201 { | |
public static void main(String args[]) throws IOException { | |
// 宣告整數變數 | |
int i; | |
// 宣告double變數 | |
double sum = 0; |
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 java.io.*; | |
public class Ex03_202 { | |
public static void main(String args[]) throws IOException { | |
// 宣告整數變數 | |
int i = 0; // 計算用 | |
int x; // 終值 | |
int sum = 0; // 總值 |
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 java.io.*; | |
public class Ex03_203 { | |
public static void main(String args[]) throws IOException { | |
// 宣告整數變數 | |
int x; // 存放數字 | |
// while重複結構 while(判斷式) | |
do { |
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 Ex03_204 { | |
public static void main(String args[]) { | |
// 宣告整數變數 | |
int i; | |
// break指令效果 | |
System.out.print("break指令效果\n"); | |
// 令i從1到100 |
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 Ex04_101 { | |
public static void main(String args[]) { | |
// 原始資料型態陣列========================================================== | |
// 宣告陣列方式1 | |
int[] ary1; | |
ary1 = new int[10]; | |
// 宣告陣列方式2 |
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 java.io.*; | |
public class Ex04_202 { | |
public static void main(String args[]) throws IOException { | |
// 宣告整數變數 | |
int i, j, x; | |
// 宣告存放數字的陣列 | |
int[] ary = new int[10]; |
OlderNewer