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
package Ex13; | |
import java.applet.Applet; | |
import java.awt.Graphics; | |
public class Ex13_101 extends Applet { | |
public void paint(Graphics g) { | |
// 畫出字串內容。 | |
// g.drawString(字串,基準x,基準x) |
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
package Ex12; | |
import java.io.*; | |
public class Ex12_007 { | |
public static void main(String args[]) { | |
// 設定路徑及檔案 | |
File file = new File("D:\\Eclipse\\Javafile", "text04.txt"); |
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
package Ex12; | |
import java.io.*; | |
public class Ex12_006 { | |
public static void main(String args[]) { | |
// 設定路徑及檔案 | |
File file = new File("D:\\Eclipse\\Javafile", "text03.txt"); |
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 Ex12_005 { | |
public static void main(String args[]) { | |
// 設定路徑及檔案 | |
File file = new File("D:\\Eclipse\\Javafile", "ch.txt"); | |
// 判斷是否有此檔案 | |
if (file.exists()) { |
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 Ex12_004 { | |
public static void main(String args[]) { | |
// 設定路徑及檔案 | |
File file = new File("D:\\Eclipse\\Javafile", "text.txt"); | |
// 判斷是否有此檔案 | |
if (file.exists()) { |
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 Ex12_003 { | |
public static void main(String args[]) { | |
// 宣告String,存放輸入字串 | |
String str = null; | |
System.out.print("請輸入文字:"); |
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 Ex12_002 { | |
public static void main(String args[]) { | |
// 宣告File | |
// 存放路徑 | |
File dir; | |
// 設定路徑 |
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 Ex12_001 { | |
public static void main(String args[]) { | |
// 宣告File | |
// 存放路徑 | |
File dir; | |
// 存放路徑檔案 | |
File file; |
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 J2Ex09_11 { | |
public static void main(String args[]) { | |
// 建立物件 | |
test a = new test(); | |
System.out.print(a.str + "\t"); | |
// 沒有給予任何參數,所以變數沒有改變 | |
System.out.print("x = " + a.x + "\t"); | |
System.out.println("y = " + a.y + "\t"); |
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 J2Ex08_41 { | |
// 當參數給兩個整數所呼叫的方法 | |
public static int Area(int w,int h){ | |
// 回傳面積 | |
return w*h; | |
} | |
// 當參數給四個整數所呼叫的方法 |