Trang 4 của 4 Đầu tiênĐầu tiên ... 234
Kết quả 31 đến 33 của 33
  1. #31
    Ngày tham gia
    Apr 2016
    Bài viết
    0
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>

    show spoiler
    hide spoiler

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    [/color][color=#ff8000]/* * to change this license header, choose license headers in project properties. * to change this template file, choose tools | templates * and open the template in the editor. */[/color][color=#0000bb]package bai27[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileinputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileoutputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filenotfoundexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]file[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];[/color][color=#ff8000]/** * * @author tran */[/color][color=#007700]public class [/color][color=#0000bb]bai27copymove [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]scanner nhap [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"command copy,move,delete:"[/color][color=#007700]); [/color][color=#0000bb]string a [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"source:"[/color][color=#007700]); [/color][color=#0000bb]string source [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"target:"[/color][color=#007700]); [/color][color=#0000bb]string target [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]fileinputstream fin[/color][color=#007700]; [/color][color=#ff8000]//đọc file [/color][color=#007700]try{ [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]source[/color][color=#007700]); }catch([/color][color=#0000bb]ioexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"inputfile not found"[/color][color=#007700]); return ; } [/color][color=#0000bb]fileoutputstream fout[/color][color=#007700]; [/color][color=#ff8000]//ghi file; [/color][color=#007700]try{ [/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]target[/color][color=#007700]); }catch([/color][color=#0000bb]ioexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"error opening output file"[/color][color=#007700]); return ; }catch([/color][color=#0000bb]arrayindexoutofbound***ception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"usage : copy to"[/color][color=#007700]); return ; } [/color][color=#ff8000]//xóa [/color][color=#0000bb]file f[/color][color=#007700]; [/color][color=#0000bb]f [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]source[/color][color=#007700]); switch ([/color][color=#0000bb]a[/color][color=#007700]){ case [/color][color=#dd0000]"copy"[/color][color=#007700]: [/color][color=#ff8000]//copy [/color][color=#0000bb]int i[/color][color=#007700]; try { do { [/color][color=#0000bb]i [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); if([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]){ [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]i[/color][color=#007700]); } } while ([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]); }catch([/color][color=#0000bb]ioexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file error"[/color][color=#007700]); } [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); break; case [/color][color=#dd0000]"move"[/color][color=#007700]: [/color][color=#ff8000]//move [/color][color=#0000bb]int j[/color][color=#007700]; try{ do{ [/color][color=#0000bb]j [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); if([/color][color=#0000bb]j [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]){ [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]j[/color][color=#007700]); } } while([/color][color=#0000bb]j [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]); }catch([/color][color=#0000bb]ioexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file error"[/color][color=#007700]); } [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700](); break; case [/color][color=#dd0000]"delete"[/color][color=#007700]: [/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700](); break; } }}[/color] 
    </blockquote></div>
    </div>
    </div>

  2. #32
    Ngày tham gia
    Apr 2014
    Đang ở
    Lô S5 - 17 Cụm công nghiệp tập trung Triều khúc, Tân triều, Thanh trì, Hà Nội
    Bài viết
    0
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>

    show spoiler
    hide spoiler

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    [/color][color=#ff8000]/* * to change this license header, choose license headers in project properties. * to change this template file, choose tools | templates * and open the template in the editor. */[/color][color=#0000bb]package bai27[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]file[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileinputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileoutputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filenotfoundexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];[/color][color=#ff8000]/** * * @author tran */[/color][color=#007700]public class [/color][color=#0000bb]copymovedelphuongthuc [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]string a[/color][color=#007700],[/color][color=#0000bb]cmd [/color][color=#007700],[/color][color=#0000bb]source [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700],[/color][color=#0000bb]target [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700]; [/color][color=#0000bb]string [/color][color=#007700][] [/color][color=#0000bb]result[/color][color=#007700]; [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"input as sample 'copy c:\test.txt e:\test.txt'"[/color][color=#007700]); [/color][color=#0000bb]cmd [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]result [/color][color=#007700]= [/color][color=#0000bb]cmd[/color][color=#007700].[/color][color=#0000bb]split[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]); [/color][color=#0000bb]a [/color][color=#007700]= [/color][color=#0000bb]result[/color][color=#007700][[/color][color=#0000bb]0[/color][color=#007700]]; [/color][color=#0000bb]source [/color][color=#007700]= [/color][color=#0000bb]result[/color][color=#007700][[/color][color=#0000bb]1[/color][color=#007700]]; [/color][color=#0000bb]target [/color][color=#007700]= [/color][color=#0000bb]result[/color][color=#007700][[/color][color=#0000bb]2[/color][color=#007700]]; [/color][color=#ff8000]//input [/color][color=#007700]switch([/color][color=#0000bb]a[/color][color=#007700]){ case [/color][color=#dd0000]"copy" [/color][color=#007700]: [/color][color=#0000bb]copyf[/color][color=#007700]([/color][color=#0000bb]source[/color][color=#007700],[/color][color=#0000bb]target[/color][color=#007700]); break; case [/color][color=#dd0000]"move" [/color][color=#007700]: [/color][color=#0000bb]movef[/color][color=#007700]([/color][color=#0000bb]source[/color][color=#007700],[/color][color=#0000bb]target[/color][color=#007700]); break; case [/color][color=#dd0000]"delete" [/color][color=#007700]: [/color][color=#0000bb]deletef[/color][color=#007700]([/color][color=#0000bb]source[/color][color=#007700]); break; default : [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"comand fail!!!!"[/color][color=#007700]); } } public static [/color][color=#0000bb]void copyf[/color][color=#007700]([/color][color=#0000bb]string source[/color][color=#007700],[/color][color=#0000bb]string target[/color][color=#007700]) [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]fileinputstream fin [/color][color=#007700]; [/color][color=#0000bb]fileoutputstream fout[/color][color=#007700]; try{ [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]source[/color][color=#007700]); }catch([/color][color=#0000bb]ioexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"input file not found"[/color][color=#007700]); return ; } try{ [/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]target[/color][color=#007700]); }catch([/color][color=#0000bb]ioexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"error oppening file"[/color][color=#007700]); return ; }catch([/color][color=#0000bb]arrayindexoutofbound***ception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"usage : copy file to"[/color][color=#007700]); return ; } [/color][color=#0000bb]int i[/color][color=#007700]; try{ do{ [/color][color=#0000bb]i [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); if([/color][color=#0000bb]i[/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]){ [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]i[/color][color=#007700]); } }while ([/color][color=#0000bb]i[/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]); }catch([/color][color=#0000bb]ioexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"copy error"[/color][color=#007700]); } [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); } public static [/color][color=#0000bb]void movef[/color][color=#007700]([/color][color=#0000bb]string source[/color][color=#007700], [/color][color=#0000bb]string target[/color][color=#007700]) [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]fileinputstream fin [/color][color=#007700]; [/color][color=#0000bb]fileoutputstream fout [/color][color=#007700]; [/color][color=#0000bb]file file[/color][color=#007700]; [/color][color=#0000bb]file [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]source[/color][color=#007700]); try{ [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]source[/color][color=#007700]); }catch([/color][color=#0000bb]ioexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"input file not found"[/color][color=#007700]); return ; } try{ [/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]target[/color][color=#007700]); } catch([/color][color=#0000bb]arrayindexoutofbound***ception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"usage : copy file to "[/color][color=#007700]); return ; } [/color][color=#0000bb]int i[/color][color=#007700]; try{ do { [/color][color=#0000bb]i [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); if ([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]i[/color][color=#007700]); } } while ([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]); }catch([/color][color=#0000bb]ioexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"move error"[/color][color=#007700]); } [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]file[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700](); } public static [/color][color=#0000bb]void deletef[/color][color=#007700]([/color][color=#0000bb]string source[/color][color=#007700]){ [/color][color=#0000bb]file file[/color][color=#007700]; [/color][color=#0000bb]file [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]source[/color][color=#007700]); [/color][color=#0000bb]file[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700](); } } [/color] 
    </blockquote></div>
    </div>
    </div>

  3. #33
    Ngày tham gia
    Apr 2015
    Bài viết
    0
    Trích dẫn Gửi bởi haizax
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>

    show spoiler
    hide spoiler

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    [/color][color=#ff8000]//biến màn hình console thành màn hình lệnh như sau://- nếu bạn gõ từ "copy", thì chương trình sẽ hỏi địa chỉ file cần copy,//bạn gõ địa chỉ file cần copy vào, nếu không tồn tại sẽ bắt nhập lại,//nếu tồn tại sẽ hỏi địa chỉ file đích,//sau đó chương trình sẽ copy file đó. tương tự với các lệnh "move", "delete"[/color][color=#0000bb]package bai27[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].*;[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]logging[/color][color=#007700].[/color][color=#0000bb]level[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]logging[/color][color=#007700].[/color][color=#0000bb]logger[/color][color=#007700];public class [/color][color=#0000bb]bai27 [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]scanner in [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]string a[/color][color=#007700],[/color][color=#0000bb]nguon[/color][color=#007700],[/color][color=#0000bb]dich[/color][color=#007700],[/color][color=#0000bb]nguon1 [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700],[/color][color=#0000bb]dich1[/color][color=#007700],[/color][color=#0000bb]xoa [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập lệnh muốn thực hiện(copy/move/delete): "[/color][color=#007700]); [/color][color=#0000bb]a [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]fileoutputstream fout [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700]; [/color][color=#0000bb]fileinputstream fin [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700]; if([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#dd0000]"copy"[/color][color=#007700])){ for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập địa chỉ file cần copy: "[/color][color=#007700]); [/color][color=#0000bb]nguon [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); try { [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]nguon[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception ex[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"địa chỉ file không tồn tại. nhập lại"[/color][color=#007700]); [/color][color=#0000bb]i[/color][color=#007700]--; } } for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"copy đến: "[/color][color=#007700]); [/color][color=#0000bb]dich [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); try { [/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]dich[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception ex[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"địa chỉ file không tồn tại. nhập lại"[/color][color=#007700]); [/color][color=#0000bb]i[/color][color=#007700]--; }catch([/color][color=#0000bb]arrayindexoutofbound***ception ex[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"lỗi"[/color][color=#007700]); } } try{ [/color][color=#0000bb]int x[/color][color=#007700]; do{ [/color][color=#0000bb]x [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); if([/color][color=#0000bb]x [/color][color=#007700]!=-[/color][color=#0000bb]1[/color][color=#007700]){ [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]x[/color][color=#007700]); } }while([/color][color=#0000bb]x [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]); }catch([/color][color=#0000bb]ioexception ex[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"error file"[/color][color=#007700]); } [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); }else if([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#dd0000]"move"[/color][color=#007700])){ for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập địa chỉ file cần di chuyển: "[/color][color=#007700]); [/color][color=#0000bb]nguon1 [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); try { [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]nguon1[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception ex[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"địa chỉ file không tồn tại. nhập lại"[/color][color=#007700]); [/color][color=#0000bb]i[/color][color=#007700]--; } } for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"chuyển đến: "[/color][color=#007700]); [/color][color=#0000bb]dich1 [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); try { [/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]dich1[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception ex[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"địa chỉ file không tồn tại. nhập lại"[/color][color=#007700]); [/color][color=#0000bb]i[/color][color=#007700]--; }catch([/color][color=#0000bb]arrayindexoutofbound***ception ex[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"lỗi"[/color][color=#007700]); } } try{ [/color][color=#0000bb]int x[/color][color=#007700]; do{ [/color][color=#0000bb]x [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); if([/color][color=#0000bb]x [/color][color=#007700]!=-[/color][color=#0000bb]1[/color][color=#007700]){ [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]x[/color][color=#007700]); } }while([/color][color=#0000bb]x [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]); }catch([/color][color=#0000bb]ioexception ex[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"error file"[/color][color=#007700]); } [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); try{ [/color][color=#0000bb]file file [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]nguon1[/color][color=#007700]); if([/color][color=#0000bb]file[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700]()){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]file[/color][color=#007700].[/color][color=#0000bb]getname[/color][color=#007700]()); }else{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"không thể xóa file gốc"[/color][color=#007700]); } }catch([/color][color=#0000bb]exception e[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"lỗi"[/color][color=#007700]+[/color][color=#0000bb]e[/color][color=#007700]); } }else if([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#dd0000]"delete"[/color][color=#007700])){ for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file cần xóa là: "[/color][color=#007700]); [/color][color=#0000bb]xoa [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); try{ [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]xoa[/color][color=#007700]); }catch([/color][color=#0000bb]filenotfoundexception ex[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file không tồn tại. nhập lại!!!"[/color][color=#007700]); [/color][color=#0000bb]i[/color][color=#007700]--; } } [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); try{ [/color][color=#0000bb]file file1 [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]xoa[/color][color=#007700]); if([/color][color=#0000bb]file1[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700]()){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]file1[/color][color=#007700].[/color][color=#0000bb]getname[/color][color=#007700]()+[/color][color=#dd0000]" xóa"[/color][color=#007700]); }else{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"không thể xóa file"[/color][color=#007700]); } }catch([/color][color=#0000bb]exception ex[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"lỗi "[/color][color=#007700]+ [/color][color=#0000bb]ex[/color][color=#007700]); } }else{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập sai lệnh !!!"[/color][color=#007700]); }}}[/color] 
    </blockquote></div>
    </div>
    </div>
    cho mình hỏi ý nghĩa của i--

Trang 4 của 4 Đầu tiênĐầu tiên ... 234

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •