-
07-23-2013, 07:00 AM #1Junior Member
- Ngày tham gia
- Oct 2014
- Bài viết
- 0
Bài 28: Đọc và ghi dữ liệu nhị phân dùng luồng byte trong Java
/* bài viết thuộc loạt bài hướng dẫn trong "khóa học lập trình java miễn phí"ở bài trước chúng ta đã đọc và ghi các bytes dữ liệu là các ký tự mã ascii. để đọc và ghi những giá trị nhị phân của các kiểu dữ liệu trong java, chúng ta sử dụng datainputstream và dataoutputstream.
trên diễn đàn android.vn, bạn có thể vào đây đọc
để hiểu hơn về khóa học và tham gia ngay cùng mọi người */
android.vn/attachments/byte-stream-jpg.18381/" border="0" alt="" />
1, dataoutputstream:
dùng để hiện thực interface dataouput.
interface dataoutput có các phương thức cho phép ghi tất cả những kiểu dữ liệu cơ sở của java đến luồng (theo định dạng nhị phân).
contructor: dataoutputstream(outputstream outputstream)
outputstream: là luồng xuất dữ liệu. để ghi dữ liệu ra file thì đối tượng outputstream có thể là fileoutputstream.
2, datainputstream:
dùng để hiện thực interface datainput.
interface datainput có các phương thức cho phép đọc tất cả những kiểu dữ liệu cơ sở của java (theo định dạng nhị phân).
contructor: datainputstream(inputstream inputstream)
inputstream: là luồng nhập dữ liệu. để đọ dữ liệu từ file thì đối tượng inputstream có thể là fileinputstream.
ví dụ: dùng dataoutputstream và datainputstream để ghi và đọc những kiểu dữ liệu khác nhau trên file.
*** chú ý: trong ví dụ dưới mình bổ sung thêm cách đọc và ghi chuỗi nữa nhé! (writeutf và readutf)
Mã nguồn PHP:[color=#000000]
package javaandroidvn[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]datainputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]dataoutputstream[/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]; class [/color][color=#0000bb]javaandroidvn [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string args[/color][color=#007700][]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]dataoutputstream dataout[/color][color=#007700]; [/color][color=#0000bb]datainputstream datain[/color][color=#007700]; [/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]2013[/color][color=#007700]; [/color][color=#0000bb]double d [/color][color=#007700]= [/color][color=#0000bb]3.14[/color][color=#007700]; [/color][color=#0000bb]boolean b [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; [/color][color=#0000bb]char ch [/color][color=#007700]= [/color][color=#dd0000]'a'[/color][color=#007700]; [/color][color=#0000bb]string str [/color][color=#007700]= [/color][color=#dd0000]"android.vn"[/color][color=#007700]; try { [/color][color=#0000bb]dataout [/color][color=#007700]= new [/color][color=#0000bb]dataoutputstream[/color][color=#007700](new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#dd0000]"e:\\androidvn.dat"[/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]"cannot open file."[/color][color=#007700]); return; } try { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"writing int: " [/color][color=#007700]+ [/color][color=#0000bb]i[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writeint[/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]"writing double: " [/color][color=#007700]+ [/color][color=#0000bb]d[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writedouble[/color][color=#007700]([/color][color=#0000bb]d[/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]"writing boolean: " [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writeboolean[/color][color=#007700]([/color][color=#0000bb]b[/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]"writing double: " [/color][color=#007700]+ [/color][color=#0000bb]12.2 [/color][color=#007700]* [/color][color=#0000bb]7.4[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writedouble[/color][color=#007700]([/color][color=#0000bb]12.2 [/color][color=#007700]* [/color][color=#0000bb]7.4[/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]"writing char: " [/color][color=#007700]+ [/color][color=#0000bb]ch[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writechar[/color][color=#007700]([/color][color=#0000bb]ch[/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]"writing string: " [/color][color=#007700]+ [/color][color=#0000bb]str[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writeutf[/color][color=#007700]([/color][color=#0000bb]str[/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]"write error."[/color][color=#007700]); } [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]close[/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=#ff8000]// next, read and show them from file [/color][color=#007700]try { [/color][color=#0000bb]datain [/color][color=#007700]= new [/color][color=#0000bb]datainputstream[/color][color=#007700]( new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#dd0000]"e:\\androidvn.dat"[/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]"cannot open file."[/color][color=#007700]); return; } try { [/color][color=#0000bb]i [/color][color=#007700]= [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readint[/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]"reading int: " [/color][color=#007700]+ [/color][color=#0000bb]i[/color][color=#007700]); [/color][color=#0000bb]d [/color][color=#007700]= [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readdouble[/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]"reading boolean: " [/color][color=#007700]+ [/color][color=#0000bb]d[/color][color=#007700]); [/color][color=#0000bb]b [/color][color=#007700]= [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readboolean[/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]"reading double: " [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700]); [/color][color=#0000bb]d [/color][color=#007700]= [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readdouble[/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]"reading double: " [/color][color=#007700]+ [/color][color=#0000bb]d[/color][color=#007700]); [/color][color=#0000bb]ch [/color][color=#007700]= [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readchar[/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]"reading char: " [/color][color=#007700]+ [/color][color=#0000bb]ch[/color][color=#007700]); [/color][color=#0000bb]str [/color][color=#007700]= [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readutf[/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]"reading string: " [/color][color=#007700]+ [/color][color=#0000bb]str[/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]"read error."[/color][color=#007700]); } [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); }}[/color]
bài tập về nhà::d
tạo đối 1 tượng sinhvien gồm các thuộc tính: tên, năm sinh, điểm trung bình. ghi các thuộc tính này vào file theo kiểu nhị phân.
đọc file in thông tin ra ngoài.
nếu chạy lại chương trình mà file đã tồn tại thì không tạo đối tượng mới nữa mà in luôn ra thông tin đối tượng đó được đọc từ file!
(chú ý: các bạn nên tự giác làm bài tập, hoàn thiện rồi đăng lên, các bài bạn đã làm, nên để code trong thẻ code - chọn thẻ php cho rõ ràng và để ẩn code trong thẻ ẩn spoiler, để khi click vào mới hiện code lên , trước khi thử sức tự làm, bạn không nên nhìn code của các bạn khác đã đăng nhé)
my facebook: https://www.facebook.com/tiasangmoi
bài viết đăng lên diễn đàn khác vui lòng ghi rõ nguồn: android.vn
-
-
08-13-2013, 07:00 AM #3Junior Member
- Ngày tham gia
- Apr 2014
- Bài viết
- 0
Gửi bởi xvirion
-
08-29-2013, 07:00 AM #4Junior Member
- Ngày tham gia
- Apr 2015
- Bài viết
- 0
Gửi bởi tiasangmoi92
-
09-23-2013, 07:00 AM #5Junior Member
- Ngày tham gia
- Apr 2016
- Bài viết
- 0
nếu mình chỉ dùng read() và write() thôi thì sao hả cậu?
cậu có thể phân biệt cụ thể khi nào dùng fileinputstream/fileoutputstream và datainputstream/dataoutputstream được không?
check giùm lỗi code cho mình
<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]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]datainputstream dis[/color][color=#007700]; [/color][color=#0000bb]dataoutputstream dos[/color][color=#007700]; [/color][color=#0000bb]string ten [/color][color=#007700]= [/color][color=#dd0000]"doan chi binh"[/color][color=#007700]; [/color][color=#0000bb]int nam_sinh [/color][color=#007700]= [/color][color=#0000bb]1980[/color][color=#007700]; [/color][color=#0000bb]double diemtb [/color][color=#007700]= [/color][color=#0000bb]7.3[/color][color=#007700]; [/color][color=#0000bb]boolean check [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; [/color][color=#0000bb]file mfile [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#dd0000]"file.dat"[/color][color=#007700]); if (![/color][color=#0000bb]mfile[/color][color=#007700].[/color][color=#0000bb]exists[/color][color=#007700]()) { [/color][color=#0000bb]mfile[/color][color=#007700].[/color][color=#0000bb]createnewfile[/color][color=#007700](); } else { [/color][color=#0000bb]check [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; } try { [/color][color=#0000bb]dis [/color][color=#007700]= new [/color][color=#0000bb]datainputstream[/color][color=#007700](new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#dd0000]"file.dat"[/color][color=#007700])); [/color][color=#0000bb]dos [/color][color=#007700]= new [/color][color=#0000bb]dataoutputstream[/color][color=#007700](new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#dd0000]"file.dat"[/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]); return; } if ([/color][color=#0000bb]check[/color][color=#007700]) { try { [/color][color=#0000bb]dos[/color][color=#007700].[/color][color=#0000bb]writeutf[/color][color=#007700]([/color][color=#0000bb]ten[/color][color=#007700]); [/color][color=#0000bb]dos[/color][color=#007700].[/color][color=#0000bb]writeint[/color][color=#007700]([/color][color=#0000bb]nam_sinh[/color][color=#007700]); [/color][color=#0000bb]dos[/color][color=#007700].[/color][color=#0000bb]writedouble[/color][color=#007700]([/color][color=#0000bb]diemtb[/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=#0000bb]ex[/color][color=#007700]); } } try { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ten: " [/color][color=#007700]+ [/color][color=#0000bb]dis[/color][color=#007700].[/color][color=#0000bb]readutf[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]dis[/color][color=#007700].[/color][color=#0000bb]readint[/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]"diem trung binh: " [/color][color=#007700]+ [/color][color=#0000bb]dis[/color][color=#007700].[/color][color=#0000bb]readdouble[/color][color=#007700]()); [/color][color=#0000bb]dos[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]dis[/color][color=#007700].[/color][color=#0000bb]close[/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=#0000bb]ex[/color][color=#007700]); } }[/color]
</div>
</div>
-
-
10-03-2013, 07:00 AM #7Junior Member
- Ngày tham gia
- Jun 2014
- 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ã:import java.io.datainputstream; import java.io.dataoutputstream; import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.ioexception; import java.util.scanner; public class vdbai28b { public static void main(string[]args) throws ioexception{ vdbai28b b=new vdbai28b(); scanner in=new scanner(system.in); string s1,s2; system.out.println("file can tao la(ho ten sinh vien): "); s1=in.nextline(); // file alt=new file(s1); // ham kiem tra xem file co ton tai trong thu muc ko? // alt.exists(); if(alt.exists()== true) { system.out.println("file da ton tai."); system.out.println("thong tin file "+s1); b.datainput(s1); } else { system.out.println("file chua ton tai.nhap thong tin file moi."); b.dataoutput(s1); b.datainput(s1); } } public static void dataoutput(string s1) throws ioexception { scanner in2=new scanner(system.in); dataoutputstream dataout; string ten; string ngaysinh; double dtb; system.out.println("nhap ten: "); ten=in2.nextline(); system.out.println("nhap ngay sinh: "); ngaysinh=in2.nextline(); system.out.println("nhap diem trung binh: "); dtb=in2.nextdouble(); in2.nextline(); try { dataout = new dataoutputstream(new fileoutputstream(s1)); } catch (ioexception exc) { system.out.println("cannot open file."); return; } try { system.out.println("writing ho ten: " + ten); dataout.writeutf(ten); system.out.println("writing ngay sinh: " + ngaysinh); dataout.writeutf(ngaysinh); system.out.println("writing ho ten: " + dtb); dataout.writedouble(dtb); } catch (ioexception exc) { system.out.println("write error."); } dataout.close(); system.out.println(); } public static void datainput(string s1) throws ioexception { datainputstream datain; string ten; string ngaysinh; double dtb; try { datain = new datainputstream( new fileinputstream(s1)); } catch (ioexception exc) { system.out.println("cannot open file."); return; } try { ten = datain.readutf(); system.out.println("reading ho ten: " + ten); ngaysinh = datain.readutf(); system.out.println("reading ngaysinh: " + ngaysinh); dtb = datain.readdouble(); system.out.println("reading dtb: " + dtb); } catch (ioexception exc) { system.out.println("read error."); } datain.close(); } }
</div>
</div>
-
10-16-2013, 07:00 AM #8Junior Member
- Ngày tham gia
- May 2015
- 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]
package bai28[/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]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]bai28 [/color][color=#007700]{ public static [/color][color=#0000bb]string f[/color][color=#007700]; public static [/color][color=#0000bb]void test[/color][color=#007700](){ [/color][color=#0000bb]scanner in1 [/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]"nhập tên file lưu thông tin sinh viên: "[/color][color=#007700]); [/color][color=#0000bb]f [/color][color=#007700]= [/color][color=#0000bb]in1[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();} public static [/color][color=#0000bb]void output[/color][color=#007700]([/color][color=#0000bb]string f[/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]dataoutputstream dataout[/color][color=#007700]; [/color][color=#0000bb]string ten[/color][color=#007700]; [/color][color=#0000bb]string tuoi[/color][color=#007700]; [/color][color=#0000bb]double diemtb[/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 tên sinh viên: "[/color][color=#007700]); [/color][color=#0000bb]ten [/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]"nhập ngày tháng năm sinh của sinh viên: "[/color][color=#007700]); [/color][color=#0000bb]tuoi [/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]"nhập điểm trung bình của sinh viên: "[/color][color=#007700]); [/color][color=#0000bb]diemtb [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700](); try { [/color][color=#0000bb]dataout [/color][color=#007700]= new [/color][color=#0000bb]dataoutputstream[/color][color=#007700](new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]f[/color][color=#007700])); } catch ([/color][color=#0000bb]filenotfoundexception ex[/color][color=#007700]) { [/color][color=#0000bb]logger[/color][color=#007700].[/color][color=#0000bb]getlogger[/color][color=#007700]([/color][color=#0000bb]bai28[/color][color=#007700].class.[/color][color=#0000bb]getname[/color][color=#007700]()).[/color][color=#0000bb]log[/color][color=#007700]([/color][color=#0000bb]level[/color][color=#007700].[/color][color=#0000bb]severe[/color][color=#007700], [/color][color=#0000bb]null[/color][color=#007700], [/color][color=#0000bb]ex[/color][color=#007700]); return; } try{ [/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ên sinh viên: "[/color][color=#007700]+[/color][color=#0000bb]ten[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writeutf[/color][color=#007700]([/color][color=#0000bb]ten[/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]"tuổi sinh viên: "[/color][color=#007700]+[/color][color=#0000bb]tuoi[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writeutf[/color][color=#007700]([/color][color=#0000bb]tuoi[/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]"điểm trung bình sinh viên: "[/color][color=#007700]+[/color][color=#0000bb]diemtb[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writedouble[/color][color=#007700]([/color][color=#0000bb]diemtb[/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]"erorr"[/color][color=#007700]); } [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]();} public static [/color][color=#0000bb]void input[/color][color=#007700]([/color][color=#0000bb]string f[/color][color=#007700]) [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]datainputstream datainp[/color][color=#007700]; [/color][color=#0000bb]string ten[/color][color=#007700]; [/color][color=#0000bb]string tuoi[/color][color=#007700]; [/color][color=#0000bb]double diemtb[/color][color=#007700]; try{ [/color][color=#0000bb]datainp [/color][color=#007700]= new [/color][color=#0000bb]datainputstream[/color][color=#007700](new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]f[/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"[/color][color=#007700]); return; } try{ [/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#0000bb]datainp[/color][color=#007700].[/color][color=#0000bb]readutf[/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]"đọc tên: "[/color][color=#007700]+[/color][color=#0000bb]ten[/color][color=#007700]); [/color][color=#0000bb]tuoi [/color][color=#007700]= [/color][color=#0000bb]datainp[/color][color=#007700].[/color][color=#0000bb]readutf[/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]"đọc tuổi: "[/color][color=#007700]+[/color][color=#0000bb]tuoi[/color][color=#007700]); [/color][color=#0000bb]diemtb [/color][color=#007700]= [/color][color=#0000bb]datainp[/color][color=#007700].[/color][color=#0000bb]readdouble[/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]"đọc điểm tb: "[/color][color=#007700]+[/color][color=#0000bb]diemtb[/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]"erorr"[/color][color=#007700]+[/color][color=#0000bb]ex[/color][color=#007700]); } [/color][color=#0000bb]datainp[/color][color=#007700].[/color][color=#0000bb]close[/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]bai28 a [/color][color=#007700]= new [/color][color=#0000bb]bai28[/color][color=#007700](); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]test[/color][color=#007700](); [/color][color=#0000bb]file file [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]f[/color][color=#007700]); if([/color][color=#0000bb]file[/color][color=#007700].[/color][color=#0000bb]exists[/color][color=#007700]() == [/color][color=#0000bb]true[/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 đã tồn tạ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]"thông tin file: "[/color][color=#007700]+[/color][color=#0000bb]f[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700]([/color][color=#0000bb]f[/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]"file chưa tồn tại
viết vào file mới"[/color][color=#007700]); [/color][color=#0000bb]file[/color][color=#007700].[/color][color=#0000bb]createnewfile[/color][color=#007700](); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]output[/color][color=#007700]([/color][color=#0000bb]f[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700]([/color][color=#0000bb]f[/color][color=#007700]); } }}[/color]
</div>
</div>
-
11-12-2013, 07:00 AM #9Junior Member
- 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 javabasic[/color][color=#007700].[/color][color=#0000bb]demo[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]datainputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]dataoutputstream[/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]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; [/color][color=#ff8000]/**** @author systemadmin*/[/color][color=#007700]class [/color][color=#0000bb]sinhvien[/color][color=#007700]{ private [/color][color=#0000bb]string ten[/color][color=#007700]; private [/color][color=#0000bb]int namsinh[/color][color=#007700]; private [/color][color=#0000bb]float diemtb[/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]); public [/color][color=#0000bb]void setten[/color][color=#007700]([/color][color=#0000bb]string ten[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#0000bb]ten[/color][color=#007700]; } public [/color][color=#0000bb]void setnamsinh[/color][color=#007700]([/color][color=#0000bb]int namsinh[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]namsinh[/color][color=#007700]; } public [/color][color=#0000bb]void setdiemtb[/color][color=#007700]([/color][color=#0000bb]float diemtb[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]diemtb [/color][color=#007700]= [/color][color=#0000bb]diemtb[/color][color=#007700]; } public [/color][color=#0000bb]string getten[/color][color=#007700]() { return [/color][color=#0000bb]ten[/color][color=#007700]; } public [/color][color=#0000bb]int getnamsinh[/color][color=#007700]() { return [/color][color=#0000bb]namsinh[/color][color=#007700]; } public [/color][color=#0000bb]float getdiemtb[/color][color=#007700]() { return [/color][color=#0000bb]diemtb[/color][color=#007700]; } public [/color][color=#0000bb]void input[/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]"enter student name: "[/color][color=#007700]); [/color][color=#0000bb]setten[/color][color=#007700]([/color][color=#0000bb]input[/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]"enter year of birth: "[/color][color=#007700]); [/color][color=#0000bb]setnamsinh[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/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]"enter average mark: "[/color][color=#007700]); [/color][color=#0000bb]setdiemtb[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]()); } [/color][color=#0000bb]dataoutputstream dataout[/color][color=#007700]; [/color][color=#0000bb]datainputstream datain[/color][color=#007700]; public [/color][color=#0000bb]void writedb[/color][color=#007700]() [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ try{ [/color][color=#0000bb]dataout [/color][color=#007700]= new [/color][color=#0000bb]dataoutputstream[/color][color=#007700](new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#dd0000]"e:\\sinhvien.dat"[/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]"cannot open file"[/color][color=#007700]); return; } try{ [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writeutf[/color][color=#007700]([/color][color=#0000bb]getten[/color][color=#007700]()); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writeint[/color][color=#007700]([/color][color=#0000bb]getnamsinh[/color][color=#007700]()); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writefloat[/color][color=#007700]([/color][color=#0000bb]getdiemtb[/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]"write error"[/color][color=#007700]); } [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); } public [/color][color=#0000bb]void showsv[/color][color=#007700]() [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ try{ [/color][color=#0000bb]datain [/color][color=#007700]= new [/color][color=#0000bb]datainputstream[/color][color=#007700](new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#dd0000]"e:\\sinhvien.dat"[/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]"cannot open file"[/color][color=#007700]); return; } try{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"student name: "[/color][color=#007700]+[/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readutf[/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]"year of birth: "[/color][color=#007700]+[/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readint[/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]"average mark: "[/color][color=#007700]+[/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readfloat[/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]"read error"[/color][color=#007700]); } [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); } public [/color][color=#0000bb]int checkdb[/color][color=#007700](){ try{ [/color][color=#0000bb]datain [/color][color=#007700]= new [/color][color=#0000bb]datainputstream[/color][color=#007700](new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#dd0000]"e:\\sinhvien.dat"[/color][color=#007700])); return [/color][color=#0000bb]1[/color][color=#007700]; }catch ([/color][color=#0000bb]ioexception exc[/color][color=#007700]) { return [/color][color=#0000bb]0[/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]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]sinhvien a [/color][color=#007700]= new [/color][color=#0000bb]sinhvien[/color][color=#007700](); if([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]checkdb[/color][color=#007700]()==[/color][color=#0000bb]0[/color][color=#007700]){ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700](); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]writedb[/color][color=#007700](); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]showsv[/color][color=#007700](); } else { [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]showsv[/color][color=#007700](); } }}[/color]
</div>
</div>
-
01-30-2014, 07:00 AM #10Junior Member
- Ngày tham gia
- Mar 2015
- 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=#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]dataoutputstream dataout [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700]; [/color][color=#0000bb]datainputstream datain[/color][color=#007700]; [/color][color=#0000bb]sinhvien sv [/color][color=#007700]= new [/color][color=#0000bb]sinhvien[/color][color=#007700](); [/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#dd0000]"nguyen van a"[/color][color=#007700]; [/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]1980[/color][color=#007700]; [/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]diemtb [/color][color=#007700]= [/color][color=#0000bb]10[/color][color=#007700]; [/color][color=#0000bb]file f [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#dd0000]"d:\\sinhvien.txt"[/color][color=#007700]); if ( ![/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]exists[/color][color=#007700]()) { try { [/color][color=#0000bb]dataout [/color][color=#007700]= new [/color][color=#0000bb]dataoutputstream[/color][color=#007700](new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#dd0000]"d:\\sinhvien.txt"[/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 not found"[/color][color=#007700]); } [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writeutf[/color][color=#007700]([/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]ten[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writeint[/color][color=#007700]([/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]namsinh[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]writefloat[/color][color=#007700]([/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]diemtb[/color][color=#007700]); [/color][color=#0000bb]dataout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); } [/color][color=#0000bb]string ten[/color][color=#007700]; [/color][color=#0000bb]int ns[/color][color=#007700]; [/color][color=#0000bb]float dtb[/color][color=#007700]; [/color][color=#0000bb]datain [/color][color=#007700]= new [/color][color=#0000bb]datainputstream[/color][color=#007700](new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#dd0000]"d:\\sinhvien.txt"[/color][color=#007700])); [/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readutf[/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]"ten sinh vien: " [/color][color=#007700]+ [/color][color=#0000bb]ten[/color][color=#007700]); [/color][color=#0000bb]ns [/color][color=#007700]= [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readint[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]ns[/color][color=#007700]); [/color][color=#0000bb]dtb [/color][color=#007700]= [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]readfloat[/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]"diem trung binh: " [/color][color=#007700]+ [/color][color=#0000bb]dtb[/color][color=#007700]); [/color][color=#0000bb]datain[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); }}class [/color][color=#0000bb]sinhvien [/color][color=#007700]{ public [/color][color=#0000bb]string ten[/color][color=#007700]; [/color][color=#0000bb]int namsinh[/color][color=#007700]; [/color][color=#0000bb]float diemtb[/color][color=#007700];}[/color]
</div>
</div>
Căn hộ cao cấp dự án Phú Đông Smart City đầu tư bởi Phú Đông Group tầm nhìn tuyệt mỹ trải rộng view xu hướng đẳng cấp. bán căn hộ Phú Đông Smart City tầm nhìn tuyệt mỹ giá hợp lý địa thế vượt trội....
Căn hộ chung cư Phú Đông Smart City khu hiện đại