Trang 2 của 2 Đầu tiênĐầu tiên 12
Kết quả 11 đến 16 của 16
  1. #11
    Ngày tham gia
    Apr 2016
    Bài viết
    0
    xem mình hộ bài này với, mình kết hợp với các bài khác làm xem ho minh có đúng không
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>bài tập (move your mouse to reveal the content)</noscript>

    bài tập (open)
    bài tập (close)

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


    Mã nguồn PHP:
    [color=#000000]
    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]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]objectinput[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]objectinputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]objectoutputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]serializable[/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];public class [/color][color=#0000bb]objectsinhvien [/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]classnotfoundexception[/color][color=#007700]{[/color][color=#0000bb]scanner sc[/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]"nhap so luong sv: "[/color][color=#007700]);[/color][color=#0000bb]int n1 [/color][color=#007700]= [/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#ff8000]//tạo file lưu dữ liệu[/color][color=#007700]try{[/color][color=#0000bb]fileoutputstream nfile[/color][color=#007700]=new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#dd0000]"e:/file/ds.txt"[/color][color=#007700]);[/color][color=#0000bb]objectoutputstream nob[/color][color=#007700]=new [/color][color=#0000bb]objectoutputstream[/color][color=#007700]([/color][color=#0000bb]nfile[/color][color=#007700]);[/color][color=#0000bb]listsv1 a[/color][color=#007700];[/color][color=#0000bb]a[/color][color=#007700]=new [/color][color=#0000bb]listsv1[/color][color=#007700]([/color][color=#0000bb]n1[/color][color=#007700]);[/color][color=#0000bb]nob[/color][color=#007700].[/color][color=#0000bb]writeobject[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700]);[/color][color=#0000bb]nfile[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();[/color][color=#0000bb]nob[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();}catch([/color][color=#0000bb]ioexception e1[/color][color=#007700]){[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"co loi xay ra"[/color][color=#007700]);}[/color][color=#ff8000]//a1= new listsv1(n1);//dọc file[/color][color=#007700]try{[/color][color=#0000bb]fileinputstream nfile[/color][color=#007700]=new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#dd0000]"e:/file/ds.txt"[/color][color=#007700]);[/color][color=#0000bb]objectinputstream nin[/color][color=#007700]=new [/color][color=#0000bb]objectinputstream[/color][color=#007700]([/color][color=#0000bb]nfile[/color][color=#007700]);[/color][color=#0000bb]listsv1 a1[/color][color=#007700];[/color][color=#0000bb]a1 [/color][color=#007700]= ([/color][color=#0000bb]listsv1[/color][color=#007700]) [/color][color=#0000bb]nin[/color][color=#007700].[/color][color=#0000bb]readobject[/color][color=#007700]();[/color][color=#0000bb]a1[/color][color=#007700].[/color][color=#0000bb]dislay[/color][color=#007700]([/color][color=#0000bb]n1[/color][color=#007700]);[/color][color=#0000bb]nin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();[/color][color=#0000bb]nfile[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();}catch([/color][color=#0000bb]ioexception e2[/color][color=#007700]){[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"co loi xay ra"[/color][color=#007700]);}[/color][color=#ff8000]//sinhvien[n1] s;[/color][color=#007700]for ([/color][color=#0000bb]int j[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700];[/color][color=#0000bb]j[/color][color=#007700]<[/color][color=#0000bb]n1[/color][color=#007700];[/color][color=#0000bb]j[/color][color=#007700]++){[/color][color=#ff8000]//a=a1[j];[/color][color=#007700]}}}[/color][color=#ff8000]//tạo class sinh viên:tên , mã thẻ, số sách nợ[/color][color=#007700]class [/color][color=#0000bb]sinhvien1 [/color][color=#007700]implements [/color][color=#0000bb]serializable[/color][color=#007700]{private [/color][color=#0000bb]string name[/color][color=#007700], [/color][color=#0000bb]mathe[/color][color=#007700];public [/color][color=#0000bb]string getname[/color][color=#007700]() {return [/color][color=#0000bb]name[/color][color=#007700];}public [/color][color=#0000bb]void setname[/color][color=#007700]([/color][color=#0000bb]string name[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]name [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700];}public [/color][color=#0000bb]string getmathe[/color][color=#007700]() {return [/color][color=#0000bb]mathe[/color][color=#007700];}public [/color][color=#0000bb]void setmathe[/color][color=#007700]([/color][color=#0000bb]string mathe[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mathe [/color][color=#007700]= [/color][color=#0000bb]mathe[/color][color=#007700];}public [/color][color=#0000bb]int getnumberbook[/color][color=#007700]() {return [/color][color=#0000bb]numberbook[/color][color=#007700];}public [/color][color=#0000bb]void setnumberbook[/color][color=#007700]([/color][color=#0000bb]int numberbook[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]numberbook [/color][color=#007700]= [/color][color=#0000bb]numberbook[/color][color=#007700];}private [/color][color=#0000bb]int numberbook[/color][color=#007700];public [/color][color=#0000bb]void nhap[/color][color=#007700](){[/color][color=#0000bb]scanner sc[/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]"nhap ho ten: "[/color][color=#007700]);[/color][color=#0000bb]name[/color][color=#007700]=[/color][color=#0000bb]sc[/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]"nhap ma the: "[/color][color=#007700]);[/color][color=#0000bb]mathe[/color][color=#007700]=[/color][color=#0000bb]sc[/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]"sach con no: "[/color][color=#007700]);[/color][color=#0000bb]numberbook[/color][color=#007700]=[/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();}}@[/color][color=#0000bb]suppresswarnings[/color][color=#007700]([/color][color=#dd0000]"serial"[/color][color=#007700])[/color][color=#ff8000]//tạo class lưu trữ danh sách sinh viên,một thuộc tính list của dữ liệu lớp sinhvien, phương thức nhập và hiển thị.[/color][color=#007700]class [/color][color=#0000bb]listsv1 [/color][color=#007700]implements [/color][color=#0000bb]serializable[/color][color=#007700]{[/color][color=#0000bb]sinhvien1[/color][color=#007700][] [/color][color=#0000bb]list1[/color][color=#007700];public [/color][color=#0000bb]listsv1[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700]){[/color][color=#0000bb]list1[/color][color=#007700]=new [/color][color=#0000bb]sinhvien1[/color][color=#007700][[/color][color=#0000bb]n[/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]n[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]++){[/color][color=#0000bb]list1[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]=new [/color][color=#0000bb]sinhvien1[/color][color=#007700]();[/color][color=#0000bb]list1[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]nhap[/color][color=#007700]();}}public [/color][color=#0000bb]void dislay[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700]){[/color][color=#0000bb]sinhvien1 ds[/color][color=#007700][];[/color][color=#0000bb]ds[/color][color=#007700]=new [/color][color=#0000bb]sinhvien1[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]];for ([/color][color=#0000bb]int j[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700];[/color][color=#0000bb]j[/color][color=#007700]<[/color][color=#0000bb]n[/color][color=#007700];[/color][color=#0000bb]j[/color][color=#007700]++){[/color][color=#0000bb]ds[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]=[/color][color=#0000bb]list1[/color][color=#007700][[/color][color=#0000bb]j[/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]"ho ten: "[/color][color=#007700]+[/color][color=#0000bb]ds[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]].[/color][color=#0000bb]getname[/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]"ma the: "[/color][color=#007700]+[/color][color=#0000bb]ds[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]].[/color][color=#0000bb]getmathe[/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]"no sach: "[/color][color=#007700]+[/color][color=#0000bb]ds[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]].[/color][color=#0000bb]getnumberbook[/color][color=#007700]());}}}[/color] 

  2. #12
    Ngày tham gia
    Aug 2014
    Bài viết
    0
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>myunit32 (move your mouse to reveal the content)</noscript>

    myunit32 (open)
    myunit32 (close)

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


    Mã nguồn PHP:
    [color=#000000]
    package hoc[/color][color=#007700].[/color][color=#0000bb]java[/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]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]objectinputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]objectoutputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]serializable[/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]; public class [/color][color=#0000bb]unit33 [/color][color=#007700]{[/color][color=#0000bb]int soluong[/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]unit33 u [/color][color=#007700]= new [/color][color=#0000bb]unit33[/color][color=#007700]();[/color][color=#0000bb]u[/color][color=#007700].[/color][color=#0000bb]outputdata[/color][color=#007700]();[/color][color=#0000bb]u[/color][color=#007700].[/color][color=#0000bb]inputdata[/color][color=#007700]();} public [/color][color=#0000bb]void inputdata[/color][color=#007700]() {try {[/color][color=#0000bb]thethuvien[/color][color=#007700][] [/color][color=#0000bb]arrthe [/color][color=#007700]= new [/color][color=#0000bb]thethuvien[/color][color=#007700][[/color][color=#0000bb]10[/color][color=#007700]];[/color][color=#0000bb]fileinputstream file [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#dd0000]"c:\\java.dat"[/color][color=#007700]);[/color][color=#0000bb]objectinputstream oit [/color][color=#007700]= new [/color][color=#0000bb]objectinputstream[/color][color=#007700]([/color][color=#0000bb]file[/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]this[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) {[/color][color=#0000bb]arrthe[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = new [/color][color=#0000bb]thethuvien[/color][color=#007700]();[/color][color=#0000bb]arrthe[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = ([/color][color=#0000bb]thethuvien[/color][color=#007700]) [/color][color=#0000bb]oit[/color][color=#007700].[/color][color=#0000bb]readobject[/color][color=#007700]();}[/color][color=#0000bb]oit[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();[/color][color=#0000bb]file[/color][color=#007700].[/color][color=#0000bb]close[/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]this[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#0000bb]arrthe[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]getmathe[/color][color=#007700]() + [/color][color=#dd0000]" | "[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#0000bb]arrthe[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]gettensv[/color][color=#007700]() + [/color][color=#dd0000]" | "[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#0000bb]arrthe[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]getsoluongsachmuon[/color][color=#007700]() + [/color][color=#dd0000]" | "[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]();} } catch ([/color][color=#0000bb]ioexception e[/color][color=#007700]) {[/color][color=#ff8000]// todo auto-generated catch block[/color][color=#0000bb]e[/color][color=#007700].[/color][color=#0000bb]printstacktrace[/color][color=#007700]();} catch ([/color][color=#0000bb]classnotfoundexception e[/color][color=#007700]) {[/color][color=#ff8000]// todo auto-generated catch block[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"khong tim thay class"[/color][color=#007700]);} } public [/color][color=#0000bb]void outputdata[/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]);try {[/color][color=#0000bb]fileoutputstream file [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#dd0000]"c:\\java.dat"[/color][color=#007700]);[/color][color=#0000bb]objectoutputstream oot [/color][color=#007700]= new [/color][color=#0000bb]objectoutputstream[/color][color=#007700]([/color][color=#0000bb]file[/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]"moi ban nhap so luong the thu vien: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]thethuvien[/color][color=#007700][] [/color][color=#0000bb]arrthe [/color][color=#007700]= new [/color][color=#0000bb]thethuvien[/color][color=#007700][[/color][color=#0000bb]soluong[/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]arrthe[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) {[/color][color=#0000bb]arrthe[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = new [/color][color=#0000bb]thethuvien[/color][color=#007700]();[/color][color=#0000bb]arrthe[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]inputthethuvien[/color][color=#007700]();[/color][color=#0000bb]oot[/color][color=#007700].[/color][color=#0000bb]writeobject[/color][color=#007700]([/color][color=#0000bb]arrthe[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]);}[/color][color=#0000bb]oot[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();[/color][color=#0000bb]file[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();} catch ([/color][color=#0000bb]ioexception e[/color][color=#007700]) {[/color][color=#ff8000]// todo auto-generated catch block[/color][color=#0000bb]e[/color][color=#007700].[/color][color=#0000bb]printstacktrace[/color][color=#007700]();}}} class [/color][color=#0000bb]thethuvien [/color][color=#007700]implements [/color][color=#0000bb]serializable [/color][color=#007700]{private [/color][color=#0000bb]string mathe[/color][color=#007700];private [/color][color=#0000bb]string tensv[/color][color=#007700];private [/color][color=#0000bb]int soluongsachmuon[/color][color=#007700]; public [/color][color=#0000bb]string getmathe[/color][color=#007700]() {return [/color][color=#0000bb]mathe[/color][color=#007700];} public [/color][color=#0000bb]void setmathe[/color][color=#007700]([/color][color=#0000bb]string mathe[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mathe [/color][color=#007700]= [/color][color=#0000bb]mathe[/color][color=#007700];} public [/color][color=#0000bb]string gettensv[/color][color=#007700]() {return [/color][color=#0000bb]tensv[/color][color=#007700];} public [/color][color=#0000bb]void settensv[/color][color=#007700]([/color][color=#0000bb]string tensv[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tensv [/color][color=#007700]= [/color][color=#0000bb]tensv[/color][color=#007700];} public [/color][color=#0000bb]int getsoluongsachmuon[/color][color=#007700]() {return [/color][color=#0000bb]soluongsachmuon[/color][color=#007700];} public [/color][color=#0000bb]void setsoluongsachmuon[/color][color=#007700]([/color][color=#0000bb]int soluongsachmuon[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluongsachmuon [/color][color=#007700]= [/color][color=#0000bb]soluongsachmuon[/color][color=#007700];} public [/color][color=#0000bb]void inputthethuvien[/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]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap ma the: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mathe [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/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]"nhap ten sinh vien: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tensv [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/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]"nhap so luong sach muon: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluongsachmuon [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();}}[/color] 
    </blockquote></div>
    </div>
    </div>

  3. #13
    Ngày tham gia
    Dec 2014
    Bài viết
    0
    Trích dẫn Gửi bởi dienlh93
    thank rất nhiều! thất sự về mấy cái nhập file trong c và c++ rất khó hiểu và mình đã ko học được! nhưng sang java cũng ko nghĩ là nó sẽ đơn giản hơn!
    quan trọng vẫn là tư duy lập trình.học ngôn ngữ nào cũng cần nó

  4. #14
    Ngày tham gia
    Mar 2015
    Đang ở
    315 - Trường Chinh - Thanh Xuân - Hà Nội
    Bài viết
    0
    Mã nguồn PHP:
    [color=#000000]
    package baitap[/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]io[/color][color=#007700].[/color][color=#0000bb]serializable[/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];class [/color][color=#0000bb]thethuvien [/color][color=#007700]implements [/color][color=#0000bb]serializable[/color][color=#007700]{public [/color][color=#0000bb]string tensv[/color][color=#007700];public [/color][color=#0000bb]int mathe[/color][color=#007700],[/color][color=#0000bb]sosachmuon[/color][color=#007700];public [/color][color=#0000bb]int getmathe[/color][color=#007700]() {return [/color][color=#0000bb]mathe[/color][color=#007700];}public [/color][color=#0000bb]int getsosachmuon[/color][color=#007700]() {return [/color][color=#0000bb]sosachmuon[/color][color=#007700];}public [/color][color=#0000bb]string gettensv[/color][color=#007700]() {return [/color][color=#0000bb]tensv[/color][color=#007700];}public [/color][color=#0000bb]void setmathe[/color][color=#007700]([/color][color=#0000bb]int mathe[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mathe [/color][color=#007700]= [/color][color=#0000bb]mathe[/color][color=#007700];}public [/color][color=#0000bb]void setsosachmuon[/color][color=#007700]([/color][color=#0000bb]int sosachmuon[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]sosachmuon [/color][color=#007700]= [/color][color=#0000bb]sosachmuon[/color][color=#007700];}public [/color][color=#0000bb]void settensv[/color][color=#007700]([/color][color=#0000bb]string tensv[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tensv [/color][color=#007700]= [/color][color=#0000bb]tensv[/color][color=#007700];}}public class [/color][color=#0000bb]unit33 [/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 innum[/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]scanner intext[/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]thethuvien a[/color][color=#007700]=new [/color][color=#0000bb]thethuvien[/color][color=#007700]();[/color][color=#0000bb]thethuvien b[/color][color=#007700]=new [/color][color=#0000bb]thethuvien[/color][color=#007700]();[/color][color=#0000bb]thethuvien c[/color][color=#007700]=new [/color][color=#0000bb]thethuvien[/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]"nhap thong tin sv a"[/color][color=#007700]);[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tensv[/color][color=#007700]=[/color][color=#0000bb]intext[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]mathe[/color][color=#007700]=[/color][color=#0000bb]innum[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]sosachmuon[/color][color=#007700]=[/color][color=#0000bb]innum[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]setmathe[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]mathe[/color][color=#007700]);[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]settensv[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tensv[/color][color=#007700]);[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]setsosachmuon[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]sosachmuon[/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]"nhap thong tin sv b"[/color][color=#007700]);[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]tensv[/color][color=#007700]=[/color][color=#0000bb]intext[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]mathe[/color][color=#007700]=[/color][color=#0000bb]innum[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]sosachmuon[/color][color=#007700]=[/color][color=#0000bb]innum[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]setmathe[/color][color=#007700]([/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]mathe[/color][color=#007700]);[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]settensv[/color][color=#007700]([/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]tensv[/color][color=#007700]);[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]setsosachmuon[/color][color=#007700]([/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]sosachmuon[/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]"nhap thong tin sv c"[/color][color=#007700]);[/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]tensv[/color][color=#007700]=[/color][color=#0000bb]intext[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]mathe[/color][color=#007700]=[/color][color=#0000bb]innum[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]sosachmuon[/color][color=#007700]=[/color][color=#0000bb]innum[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]setmathe[/color][color=#007700]([/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]mathe[/color][color=#007700]);[/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]settensv[/color][color=#007700]([/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]tensv[/color][color=#007700]);[/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]setsosachmuon[/color][color=#007700]([/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]sosachmuon[/color][color=#007700]);try {[/color][color=#0000bb]fileoutputstream f [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#dd0000]"d:\\sinhvien.txt"[/color][color=#007700]);[/color][color=#0000bb]objectoutputstream oot[/color][color=#007700]= new [/color][color=#0000bb]objectoutputstream[/color][color=#007700]([/color][color=#0000bb]f[/color][color=#007700]);[/color][color=#0000bb]oot[/color][color=#007700].[/color][color=#0000bb]writeobject[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700]);[/color][color=#0000bb]oot[/color][color=#007700].[/color][color=#0000bb]writeobject[/color][color=#007700]([/color][color=#0000bb]b[/color][color=#007700]);[/color][color=#0000bb]oot[/color][color=#007700].[/color][color=#0000bb]writeobject[/color][color=#007700]([/color][color=#0000bb]c[/color][color=#007700]);[/color][color=#0000bb]oot[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();[/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();} catch ([/color][color=#0000bb]ioexception 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]"xay ra loi 1: "[/color][color=#007700]+[/color][color=#0000bb]e[/color][color=#007700]);}[/color][color=#0000bb]thethuvien a1 [/color][color=#007700]= new [/color][color=#0000bb]thethuvien[/color][color=#007700]();[/color][color=#0000bb]thethuvien b1 [/color][color=#007700]= new [/color][color=#0000bb]thethuvien[/color][color=#007700]();[/color][color=#0000bb]thethuvien c1 [/color][color=#007700]= new [/color][color=#0000bb]thethuvien[/color][color=#007700]();try {[/color][color=#0000bb]fileinputstream f [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#dd0000]"d:\\sinhvien.txt"[/color][color=#007700]);[/color][color=#0000bb]objectinputstream oit [/color][color=#007700]= new [/color][color=#0000bb]objectinputstream[/color][color=#007700]([/color][color=#0000bb]f[/color][color=#007700]);[/color][color=#0000bb]a1[/color][color=#007700]= ([/color][color=#0000bb]thethuvien[/color][color=#007700]) [/color][color=#0000bb]oit[/color][color=#007700].[/color][color=#0000bb]readobject[/color][color=#007700]();[/color][color=#0000bb]b1[/color][color=#007700]= ([/color][color=#0000bb]thethuvien[/color][color=#007700]) [/color][color=#0000bb]oit[/color][color=#007700].[/color][color=#0000bb]readobject[/color][color=#007700]();[/color][color=#0000bb]c1[/color][color=#007700]= ([/color][color=#0000bb]thethuvien[/color][color=#007700]) [/color][color=#0000bb]oit[/color][color=#007700].[/color][color=#0000bb]readobject[/color][color=#007700]();[/color][color=#0000bb]oit[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();[/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();} catch ([/color][color=#0000bb]ioexception 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]"xay ra loi 2: "[/color][color=#007700]+[/color][color=#0000bb]e[/color][color=#007700]);}catch([/color][color=#0000bb]classnotfoundexception 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]"khong tim thay class"[/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]"thong tin the thu vien sv a1 doc ra la:
    ten: "[/color][color=#007700]+[/color][color=#0000bb]a1[/color][color=#007700].[/color][color=#0000bb]tensv[/color][color=#007700]+[/color][color=#dd0000]"
    ma the: "[/color][color=#007700]+[/color][color=#0000bb]a1[/color][color=#007700].[/color][color=#0000bb]mathe[/color][color=#007700]+[/color][color=#dd0000]"
    so sach muon: "[/color][color=#007700]+[/color][color=#0000bb]a1[/color][color=#007700].[/color][color=#0000bb]sosachmuon[/color][color=#007700]+[/color][color=#dd0000]"
    "[/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]"
    thong tin the thu vien sv b1 doc ra la:
    ten
    : "[/color][color=#007700]+[/color][color=#0000bb]b1[/color][color=#007700].[/color][color=#0000bb]tensv[/color][color=#007700]+[/color][color=#dd0000]"
    ma the: "[/color][color=#007700]+[/color][color=#0000bb]b1[/color][color=#007700].[/color][color=#0000bb]mathe[/color][color=#007700]+[/color][color=#dd0000]"
    so sach muon: "[/color][color=#007700]+[/color][color=#0000bb]b1[/color][color=#007700].[/color][color=#0000bb]sosachmuon[/color][color=#007700]+[/color][color=#dd0000]"
    "[/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]"
    thong tin the thu vien sv c1 doc ra la:
    ten
    : "[/color][color=#007700]+[/color][color=#0000bb]c1[/color][color=#007700].[/color][color=#0000bb]tensv[/color][color=#007700]+[/color][color=#dd0000]"
    ma the: "[/color][color=#007700]+[/color][color=#0000bb]c1[/color][color=#007700].[/color][color=#0000bb]mathe[/color][color=#007700]+[/color][color=#dd0000]"
    so sach muon: "[/color][color=#007700]+[/color][color=#0000bb]c1[/color][color=#007700].[/color][color=#0000bb]sosachmuon[/color][color=#007700]);}}[/color] 

  5. #15
    Ngày tham gia
    May 2015
    Bài viết
    0
    Trích dẫn Gửi bởi haihack
    bài tập này không khác ví dụ mẫu là mấy
    <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=#007700]class [/color][color=#0000bb]thethuvien [/color][color=#007700]implements [/color][color=#0000bb]serializable [/color][color=#007700]{ private [/color][color=#0000bb]string ma_the[/color][color=#007700]; private [/color][color=#0000bb]string ten_sv[/color][color=#007700]; private [/color][color=#0000bb]int so_sach_muon[/color][color=#007700]; public [/color][color=#0000bb]thethuvien[/color][color=#007700]([/color][color=#0000bb]string ma_the[/color][color=#007700], [/color][color=#0000bb]string ten_sv[/color][color=#007700], [/color][color=#0000bb]int so_sach_muon[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ma_the [/color][color=#007700]= [/color][color=#0000bb]ma_the[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ten_sv [/color][color=#007700]= [/color][color=#0000bb]ten_sv[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]so_sach_muon [/color][color=#007700]= [/color][color=#0000bb]so_sach_muon[/color][color=#007700]; } public [/color][color=#0000bb]string getma_the[/color][color=#007700]() { return [/color][color=#0000bb]ma_the[/color][color=#007700]; } public [/color][color=#0000bb]string getten_sv[/color][color=#007700]() { return [/color][color=#0000bb]ten_sv[/color][color=#007700]; } public [/color][color=#0000bb]int getso_sach_muon[/color][color=#007700]() { return [/color][color=#0000bb]so_sach_muon[/color][color=#007700]; } } public class [/color][color=#0000bb]baitap2 [/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]thethuvien a [/color][color=#007700]= new [/color][color=#0000bb]thethuvien[/color][color=#007700]([/color][color=#dd0000]"a1"[/color][color=#007700], [/color][color=#dd0000]"luffy"[/color][color=#007700],[/color][color=#0000bb]1[/color][color=#007700]); [/color][color=#0000bb]thethuvien b [/color][color=#007700]= new [/color][color=#0000bb]thethuvien[/color][color=#007700]([/color][color=#dd0000]"a2"[/color][color=#007700], [/color][color=#dd0000]"zoro"[/color][color=#007700], [/color][color=#0000bb]2[/color][color=#007700]); [/color][color=#0000bb]thethuvien c [/color][color=#007700]= new [/color][color=#0000bb]thethuvien[/color][color=#007700]([/color][color=#dd0000]"a3"[/color][color=#007700], [/color][color=#dd0000]"nami"[/color][color=#007700], [/color][color=#0000bb]3[/color][color=#007700]); try { [/color][color=#0000bb]fileoutputstream f [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#dd0000]"e:\\thethuvien.dat"[/color][color=#007700]); [/color][color=#0000bb]objectoutputstream oos [/color][color=#007700]= new [/color][color=#0000bb]objectoutputstream[/color][color=#007700]([/color][color=#0000bb]f[/color][color=#007700]); [/color][color=#0000bb]oos[/color][color=#007700].[/color][color=#0000bb]writeobject[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700]); [/color][color=#0000bb]oos[/color][color=#007700].[/color][color=#0000bb]writeobject[/color][color=#007700]([/color][color=#0000bb]b[/color][color=#007700]); [/color][color=#0000bb]oos[/color][color=#007700].[/color][color=#0000bb]writeobject[/color][color=#007700]([/color][color=#0000bb]c[/color][color=#007700]); [/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]oos[/color][color=#007700].[/color][color=#0000bb]close[/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=#0000bb]ex[/color][color=#007700]); } catch ([/color][color=#0000bb]ioexception 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=#0000bb]e[/color][color=#007700]); } try { [/color][color=#0000bb]fileinputstream f [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#dd0000]"e:\\thethuvien.dat"[/color][color=#007700]); [/color][color=#0000bb]objectinputstream ois [/color][color=#007700]= new [/color][color=#0000bb]objectinputstream[/color][color=#007700]([/color][color=#0000bb]f[/color][color=#007700]); [/color][color=#0000bb]a [/color][color=#007700]= ([/color][color=#0000bb]thethuvien[/color][color=#007700]) [/color][color=#0000bb]ois[/color][color=#007700].[/color][color=#0000bb]readobject[/color][color=#007700](); [/color][color=#0000bb]b [/color][color=#007700]= ([/color][color=#0000bb]thethuvien[/color][color=#007700]) [/color][color=#0000bb]ois[/color][color=#007700].[/color][color=#0000bb]readobject[/color][color=#007700](); [/color][color=#0000bb]c [/color][color=#007700]= ([/color][color=#0000bb]thethuvien[/color][color=#007700]) [/color][color=#0000bb]ois[/color][color=#007700].[/color][color=#0000bb]readobject[/color][color=#007700](); [/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]ois[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); } catch ([/color][color=#0000bb]classnotfoundexception [/color][color=#007700]| [/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=#0000bb]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]"thong tin the thu vien thu nhat:
    ma the: " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getma_the[/color][color=#007700]() + [/color][color=#dd0000]"
    ten: " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getten_sv[/color][color=#007700]() + [/color][color=#dd0000]"
    so sach muon: " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getso_sach_muon[/color][color=#007700]() + [/color][color=#dd0000]"
    ----------"[/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]"thong tin the thu vien thu hai:
    ma the: " [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getma_the[/color][color=#007700]() + [/color][color=#dd0000]"
    ten: " [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getten_sv[/color][color=#007700]() + [/color][color=#dd0000]"
    so sach muon: " [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getso_sach_muon[/color][color=#007700]() + [/color][color=#dd0000]"
    ----------"[/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]"thong tin the thu vien thu ba:
    ma the: " [/color][color=#007700]+ [/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]getma_the[/color][color=#007700]() + [/color][color=#dd0000]"
    ten: " [/color][color=#007700]+ [/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]getten_sv[/color][color=#007700]() + [/color][color=#dd0000]"
    so sach muon: " [/color][color=#007700]+ [/color][color=#0000bb]c[/color][color=#007700].[/color][color=#0000bb]getso_sach_muon[/color][color=#007700]() + [/color][color=#dd0000]"
    ----------"[/color][color=#007700]); }}[/color] 
    </blockquote></div>
    </div>
    </div>
    bai nay yeu cau nhap tu ban phim ma

  6. #16
    Ngày tham gia
    Feb 2015
    Bài viết
    0
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>btvn - bai33 (move your mouse to reveal the content)</noscript>

    btvn - bai33 (open)
    btvn - bai33 (close)

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


    Mã nguồn PHP:
    [color=#000000]
    package baitapvenha[/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]filenotfoundexception[/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]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]objectinputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]objectoutputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]serializable[/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]/*** class thẻ thư viện có các thuộc tính: mã thẻ, tên sinh viên, số sách mượn.* tạo ra 3 đối tượng thẻ thư viện, gán giá trị nhập vào từ bàn phím. ghi lại* thông tin 3 đối tượng này xuống file theo kiểu object rồi đọc file đó, đọc dữ* liệu các đối tượng từ trong file vừa ghi, in ra màn hình!*/[/color][color=#007700]public class [/color][color=#0000bb]bai33_rwobject [/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]thetv the1 [/color][color=#007700]= new [/color][color=#0000bb]thetv[/color][color=#007700](); [/color][color=#0000bb]thetv the2 [/color][color=#007700]= new [/color][color=#0000bb]thetv[/color][color=#007700](); [/color][color=#0000bb]thetv the3 [/color][color=#007700]= new [/color][color=#0000bb]thetv[/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]"
    nhap the1: "[/color][color=#007700]); [/color][color=#0000bb]the1[/color][color=#007700].[/color][color=#0000bb]nhaptt[/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]"
    nhap the2: "[/color][color=#007700]); [/color][color=#0000bb]the2[/color][color=#007700].[/color][color=#0000bb]nhaptt[/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]"
    nhap the3: "[/color][color=#007700]); [/color][color=#0000bb]the3[/color][color=#007700].[/color][color=#0000bb]nhaptt[/color][color=#007700](); try { [/color][color=#0000bb]fileoutputstream fo [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#dd0000]"e:\\demofile\\thuvien.dat"[/color][color=#007700]); [/color][color=#0000bb]objectoutputstream oot [/color][color=#007700]= new [/color][color=#0000bb]objectoutputstream[/color][color=#007700]([/color][color=#0000bb]fo[/color][color=#007700]); [/color][color=#0000bb]oot[/color][color=#007700].[/color][color=#0000bb]writeobject[/color][color=#007700]([/color][color=#0000bb]the1[/color][color=#007700]); [/color][color=#0000bb]oot[/color][color=#007700].[/color][color=#0000bb]writeobject[/color][color=#007700]([/color][color=#0000bb]the2[/color][color=#007700]); [/color][color=#0000bb]oot[/color][color=#007700].[/color][color=#0000bb]writeobject[/color][color=#007700]([/color][color=#0000bb]the3[/color][color=#007700]); [/color][color=#0000bb]fo[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]oot[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); } catch ([/color][color=#0000bb]filenotfoundexception e[/color][color=#007700]) { [/color][color=#ff8000]// todo: handle exception [/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 "[/color][color=#007700]+[/color][color=#0000bb]e[/color][color=#007700]); } catch ([/color][color=#0000bb]ioexception e[/color][color=#007700]) { [/color][color=#ff8000]// todo auto-generated catch block [/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 "[/color][color=#007700]+[/color][color=#0000bb]e[/color][color=#007700]); } try { [/color][color=#0000bb]fileinputstream fi [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#dd0000]"e:\\demofile\\thuvien.dat"[/color][color=#007700]); [/color][color=#0000bb]objectinputstream oit [/color][color=#007700]= new [/color][color=#0000bb]objectinputstream[/color][color=#007700]([/color][color=#0000bb]fi[/color][color=#007700]); [/color][color=#0000bb]the1 [/color][color=#007700]= ([/color][color=#0000bb]thetv[/color][color=#007700]) [/color][color=#0000bb]oit[/color][color=#007700].[/color][color=#0000bb]readobject[/color][color=#007700](); [/color][color=#0000bb]the2 [/color][color=#007700]= ([/color][color=#0000bb]thetv[/color][color=#007700]) [/color][color=#0000bb]oit[/color][color=#007700].[/color][color=#0000bb]readobject[/color][color=#007700](); [/color][color=#0000bb]the3 [/color][color=#007700]= ([/color][color=#0000bb]thetv[/color][color=#007700]) [/color][color=#0000bb]oit[/color][color=#007700].[/color][color=#0000bb]readobject[/color][color=#007700](); [/color][color=#0000bb]fi[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]oit[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); } catch ([/color][color=#0000bb]ioexception e[/color][color=#007700]) { [/color][color=#ff8000]// todo: handle exception [/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: "[/color][color=#007700]+[/color][color=#0000bb]e[/color][color=#007700]); } catch ([/color][color=#0000bb]classnotfoundexception e[/color][color=#007700]) { [/color][color=#ff8000]// todo: handle exception [/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: "[/color][color=#007700]+[/color][color=#0000bb]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]"thong tin the thu vien:"[/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]"\tmathe\tten\tsosachmuon"[/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]"\t"[/color][color=#007700]+[/color][color=#0000bb]the1[/color][color=#007700].[/color][color=#0000bb]getmathe[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]the1[/color][color=#007700].[/color][color=#0000bb]gettensv[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]the1[/color][color=#007700].[/color][color=#0000bb]getsosachmuon[/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]"\t"[/color][color=#007700]+[/color][color=#0000bb]the2[/color][color=#007700].[/color][color=#0000bb]getmathe[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]the2[/color][color=#007700].[/color][color=#0000bb]gettensv[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]the2[/color][color=#007700].[/color][color=#0000bb]getsosachmuon[/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]"\t"[/color][color=#007700]+[/color][color=#0000bb]the3[/color][color=#007700].[/color][color=#0000bb]getmathe[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]the3[/color][color=#007700].[/color][color=#0000bb]gettensv[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]the3[/color][color=#007700].[/color][color=#0000bb]getsosachmuon[/color][color=#007700]()); } } class [/color][color=#0000bb]thetv [/color][color=#007700]implements [/color][color=#0000bb]serializable[/color][color=#007700]{ private [/color][color=#0000bb]string mathe[/color][color=#007700], [/color][color=#0000bb]tensv[/color][color=#007700]; private [/color][color=#0000bb]int sosachmuon[/color][color=#007700]; public [/color][color=#0000bb]void nhaptt[/color][color=#007700]() { [/color][color=#0000bb]scanner sc [/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]"ma the : "[/color][color=#007700]); [/color][color=#0000bb]mathe [/color][color=#007700]= [/color][color=#0000bb]sc[/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]"ten sv : "[/color][color=#007700]); [/color][color=#0000bb]tensv [/color][color=#007700]= [/color][color=#0000bb]sc[/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]"so sach muon : "[/color][color=#007700]); try { [/color][color=#0000bb]sosachmuon [/color][color=#007700]= [/color][color=#0000bb]integer[/color][color=#007700].[/color][color=#0000bb]parseint[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); } catch ([/color][color=#0000bb]exception e[/color][color=#007700]) { [/color][color=#ff8000]// todo: handle exception [/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: "[/color][color=#007700]+[/color][color=#0000bb]e[/color][color=#007700]); } } public [/color][color=#0000bb]string getmathe[/color][color=#007700]() { return [/color][color=#0000bb]mathe[/color][color=#007700]; } public [/color][color=#0000bb]string gettensv[/color][color=#007700]() { return [/color][color=#0000bb]tensv[/color][color=#007700]; } public [/color][color=#0000bb]int getsosachmuon[/color][color=#007700]() { return [/color][color=#0000bb]sosachmuon[/color][color=#007700]; } }[/color] 
    </blockquote></div>
    </div>
    </div>

Trang 2 của 2 Đầu tiênĐầu tiên 12

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
  •