關於我自己

我的相片
Welcome to discuss about : Chinese Traditional Medicine and Acupuncture Please send me the email: tccnchsu@gmail.com Chih-Yu Hsu

最新消息

總瀏覽量

2009年3月12日 星期四

Java 第四週

上課錄影
http://www.powercam.cc/slide/1133


--------------------------------------------------------------------
import java.io.*;

class Myfourthjava
{
public static void main(String[] args)
{
String Inputfile;
System.out.println(args[0]);
Inputfile=args[0];
File position=new File(Inputfile);
try{
BufferedReader input = new BufferedReader(new FileReader( position ) );
int num = Integer.parseInt(input.readLine());
System.out.println(num );
}
catch(Exception e)
{
System.out.println("Error:"+e);
}



}
}
---------------------------------------------------------------------------
9 6 年度全國技術士技能檢定簡章
http://www.labor.gov.tw/management/sitemap_upload_file/G1_1626_.pdf
乙級技術士技能檢定
http://www.google.com.tw/search?hl=zh-TW&q=%E4%B9%99%E7%B4%9A%E6%8A%80%E8%A1%93%E5%A3%AB%E6%8A%80%E8%83%BD%E6%AA%A2%E5%AE%9A&btnG=%E6%90%9C%E5%B0%8B&meta=&aq=f&oq=
-------------------------------------------------------------------------
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.util.StringTokenizer;


public class Perm {
static int[] array;
static String output = "";
public static void main(String[] args) {
File position;
File text;
String InFileName,OutFileName;

try{
InFileName = args[0];
StringTokenizer tokens = new StringTokenizer( InFileName, ".t");
position = new File(InFileName);
OutFileName = tokens.nextToken() + ".w" + tokens.nextToken();
System.out.print("Input File Name:" + InFileName + "\n" );
System.out.print("Output to the File :" + OutFileName);
text = new File(OutFileName);
}
catch(Exception e){
System.out.println("Error:"+e);
System.exit(1);
position = new File("");
text = new File("");
}


try{
BufferedReader input = new BufferedReader(new FileReader( position ) );
int num = Integer.parseInt(input.readLine());
array = new int[num+1];
for(int j=1; j<=num ; j++)
array[j]=j;
recursive(array, 1, num);
}

catch(IOException IOException){ }


try{

BufferedWriter output1 = new BufferedWriter(new FileWriter( text) );
output1.write(output);
output1.flush();

}
catch(IOException IOException){
}
System.exit(0);
}


public static void print(int[] a,int n, int k, int ii)
{
for (int i=1; i<=n; i++)
{
output+="The output is\n " +a[i];
}
output+="\n";
}
public static void recursive(int[] a, int k, int n)
{
int i, t;
for (i=1; i<=n; i++)
{
a[i] = a[i];
}
if(k==n)
{
for (i=1; i<=n; i++)
{
output+=" "+a[i];
}
output+="\n";
}
else
{
for(i=k; i<=n; i++)
{
t=a[i];
a[i]=a[k];
a[k]=t;
recursive(x, k, n);
}
}
}

}
------------------------------------------------------
930201.s01
------------------------------------------------------
3

11 則留言:

歐地 提到...

//第四週作業 D9539125 黃培熏
import java.io.*;
import java.util.StringTokenizer;

class HPS_004
{
public static void main(String[] args)
{
System.out.println("檔案名稱:"+args[0]);
String InFileName = args[0];
String OutFileName="";
String output = "";
File text;
File position = new File(args[0]);

try
{
StringTokenizer tokens = new StringTokenizer( InFileName, ".t");
OutFileName = tokens.nextToken() + ".w" + tokens.nextToken()+".txt";
text = new File(OutFileName);
}
catch(Exception e)
{
text = new File("");
System.out.println("錯誤:"+e);
}

try
{
BufferedReader input = new BufferedReader(new FileReader(position) );
int num = Integer.parseInt(input.readLine());
output+=num;
System.out.println("檔案內容:"+num);
}
catch(Exception e)
{
System.out.println("錯誤:"+e);
}

try{
BufferedWriter output1 = new BufferedWriter(new FileWriter(text));
output1.write(output);
output1.flush();
System.out.println("已把"+InFileName+"檔案內容寫入"+OutFileName+"中了!");
}
catch(Exception e)
{
System.out.println("錯誤:"+e);
}
}
}

aoitsukikage 提到...

//光電四 D9427925
import java.io.*;
class Myfourthjava
{
public static void main(String[] args)
{
String inputfile;
inputfile=args[0];
System.out.println(args[0]);
File position = new File(inputfile);
try{
BufferedReader input = new BufferedReader(new FileReader( position ) );

int num = Integer.parseInt(input.readLine());
System.out.println(num);
try
{
FileOutputStream fos = new FileOutputStream
("C:\\Myjava\\test.txt");
BufferedOutputStream bos = new BufferedOutputStream
(fos);

PrintStream ps = new PrintStream(bos);

ps.println(num);
ps.close();
bos.close();
fos.close();
}
catch (Exception e)
{
System.err.println(e);
}
}
catch(Exception e){ }


}
}

子堡 提到...

//D9582375 應數三甲 林子堡
import java.io.*;
import java.io.PrintStream;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;

public class Forth extends Object
{
public static void main (String []args)
{
String inputfile;

System.out.println(args[0]);

inputfile=args[0];

File position = new File(inputfile);

try
{
BufferedReader input = new BufferedReader(new FileReader(position));
int num = Integer.parseInt(input.readLine());
System.out.println(num);

try
{
FileOutputStream fos = new FileOutputStream("C:\\ap6\\test.txt");
BufferedOutputStream bos = new BufferedOutputStream(fos);
PrintStream ps = new PrintStream(bos);

ps.println(num);
ps.close();
bos.close();
fos.close();
}

catch(Exception e)
{
System.err.println(e);
}

}

catch(Exception e)
{
System.out.print("Error:"+e);
}

}
}

何孟弦 提到...

/*何孟弦 D9648991*/
import java.io.*;

class Myfourthjava
{
public static void main(String[] args)
{
String inputfile;
System.out.println(args[0]);
inputfile=args[0];
File position=new File(inputfile);
try{
BufferedReader input = new BufferedReader(new FileReader( position ) );
int num = Integer.parseInt(input.readLine());
System.out.println(num);




try
{
FileOutputStream fos = new FileOutputStream
("c:\\myjava1\\test.txt");
BufferedOutputStream bos = new BufferedOutputStream
(fos);
PrintStream ps = new PrintStream(bos);

ps.println(num);
ps.close();
bos.close();
fos.close();
}
catch (Exception e)
{
System.err.println(e);
}





}
catch(Exception e)
{
System.out.println("Error:"+e);
}

}
}

靖文 提到...
作者已經移除這則留言。
靖文 提到...

// b5.java
// D9539108 陸靖文
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.util.StringTokenizer;

class b5 {
static String output = "";

public static void main(String[] args) {
//String output = "";
String Inputfile,Outputfile;
File position;
File text;
try{
Inputfile=args[0];
StringTokenizer tokens = new StringTokenizer( Inputfile, ".t");
position= new File(Inputfile);
Outputfile= tokens.nextToken() + ".w" + tokens.nextToken();
text = new File(Outputfile);
}
catch(Exception e){
System.out.println("Error:"+e);
position = new File("");
text = new File("");
}
try{
BufferedReader input = new BufferedReader(new FileReader(position));
int num = Integer.parseInt(input.readLine());
output+=num;
//System.out.println(num);

}
catch(Exception e){
System.out.println("Error:"+e);
}

try{
BufferedWriter output1 = new BufferedWriter(new FileWriter( text) );
output1.write(output);
output1.flush();
}
catch(Exception e){
System.out.println("Error:"+e);

}
}
}

益銘梁 提到...

import java.io.*;

class Myfourthjava
{
public static void main(String[] args)
{
String Inputfile;
System.out.println(args[0]);
Inputfile=args[0];
File position=new File(Inputfile);

try{
int x;
FileOutputStream fos = new FileOutputStream
("c:\\myjava\\test.txt");
BufferedOutputStream bos = new BufferedOutputStream
(fos);
PrintStream ps = new PrintStream(bos);

ps.println(num);
ps.close();
bos.close();
fos.close();
}
catch(Exception e)
{
System.err.println(e);
}

try{
BufferedReader input = new BufferedReader(new FileReader( position ) );
int num = Integer.parseInt(input.readLine());
System.out.println(num );
}
catch(Exception e)
{
System.out.println("Error:"+e);
}
}
}

提到...
作者已經移除這則留言。
提到...

劉羽程
import java.io.*;

class stack3
{
public static void main(String[] args)
{
String inputfile;
System.out.println(args[0]);
inputfile=args[0];
File position=new File(inputfile);
try{
BufferedReader input = new BufferedReader(new FileReader( position ) );
int num = Integer.parseInt(input.readLine());
System.out.println(num);
try
{
FileOutputStream fos = new FileOutputStream
("c:\\myjava\\930201.ws01");
BufferedOutputStream bos = new BufferedOutputStream
(fos);
PrintStream ps = new PrintStream(bos);

ps.println(num);
ps.close();
bos.close();
fos.close();
}
catch (Exception e)
{
System.err.println(e);
}
}
catch(Exception e)
{
System.out.println("Error:"+e);
}
}
}

dragon 提到...

/*d9582608*/
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.util.StringTokenizer;
class dark4
{
static String output = "";
public static void main(String[] args)
{
String InFileName,OutFileName;
File position;
File text;
try
{
InFileName = args[0];
position = new File(InFileName);
StringTokenizer tokens = new StringTokenizer( InFileName, ".t");
OutFileName = tokens.nextToken() + ".w" + tokens.nextToken();
System.out.print("Input File Name:" + InFileName+"\n" );
System.out.print("Output to the File :" + OutFileName);
text = new File(OutFileName);
}
catch(Exception e)
{
System.out.println("Error:"+e);
System.exit(1);
position = new File("");
text = new File("");
}
try
{
BufferedReader input = new BufferedReader(new FileReader( position ) );
int num = Integer.parseInt(input.readLine());
output+=num;
}
catch(Exception e){
System.out.println("Error:"+e);
}
try
{
BufferedWriter output1 = new BufferedWriter(new FileWriter( text) );
output1.write(output);
output1.flush();
}
catch(Exception e)
{
System.out.println("Error:"+e);
}
}
}

提到...

//第四週作業 D9476668陳秋宇
import java.io.*;
import java.util.StringTokenizer;

class HPS_004
{
public static void main(String[] args)
{
System.out.println("檔案名稱:"+args[0]);
String InFileName = args[0];
String OutFileName="";
String output = "";
File text;
File position = new File(args[0]);

try
{
StringTokenizer tokens = new StringTokenizer( InFileName, ".t");
OutFileName = tokens.nextToken() + ".w" + tokens.nextToken()+".txt";
text = new File(OutFileName);
}
catch(Exception e)
{
text = new File("");
System.out.println("錯誤:"+e);
}

try
{
BufferedReader input = new BufferedReader(new FileReader(position) );
int num = Integer.parseInt(input.readLine());
output+=num;
System.out.println("檔案內容:"+num);
}
catch(Exception e)
{
System.out.println("錯誤:"+e);
}

try{
BufferedWriter output1 = new BufferedWriter(new FileWriter(text));
output1.write(output);
output1.flush();
System.out.println("已把"+InFileName+"檔案內容寫入"+OutFileName+"中了!");
}
catch(Exception e)
{
System.out.println("錯誤:"+e);
}
}
}