Skip to content

Instantly share code, notes, and snippets.

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)
package Ex12;
import java.io.*;
public class Ex12_007 {
public static void main(String args[]) {
// 設定路徑及檔案
File file = new File("D:\\Eclipse\\Javafile", "text04.txt");
package Ex12;
import java.io.*;
public class Ex12_006 {
public static void main(String args[]) {
// 設定路徑及檔案
File file = new File("D:\\Eclipse\\Javafile", "text03.txt");
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()) {
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()) {
import java.io.*;
public class Ex12_003 {
public static void main(String args[]) {
// 宣告String,存放輸入字串
String str = null;
System.out.print("請輸入文字:");
import java.io.*;
public class Ex12_002 {
public static void main(String args[]) {
// 宣告File
// 存放路徑
File dir;
// 設定路徑
import java.io.*;
public class Ex12_001 {
public static void main(String args[]) {
// 宣告File
// 存放路徑
File dir;
// 存放路徑檔案
File file;
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");
public class J2Ex08_41 {
// 當參數給兩個整數所呼叫的方法
public static int Area(int w,int h){
// 回傳面積
return w*h;
}
// 當參數給四個整數所呼叫的方法