12345678910111213publicclassVidu {finalfloatcost;publicfloatcalculateSalePrice() {returncost *1.5;}publicfloatCalculateSalePrice(doubleheso) {returncost * (1+ heso);}}
This is default featured slide 1 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
This is default featured slide 2 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
This is default featured slide 3 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
This is default featured slide 4 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
This is default featured slide 5 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
Hiển thị các bài đăng có nhãn JAVA. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn JAVA. Hiển thị tất cả bài đăng
Thứ Bảy, 20 tháng 8, 2016
BÀI TẬP LÀM QUEN JAVA
Yêu
cầu: Mỗi sinh
viên làm ít nhất 30 bài tập.
Hạn nộp: 1 tuần – qua email hoặc nộp trực
tiếp cho giáo viên vào ngày 01/09/2009
=================================================================
Bài 1. Viết chương trình tìm ước số chung lớn nhất,
bội số chung nhỏ nhất của hai số tự nhiên a và b.
Bài 2. Viết
chương trình chuyển đổi một số tự nhiên ở hệ cơ số 10 thành số ở hệ cơ số b bất
kì (1< b≤ 36).
JAVA 4
Interface - template
Bây giờ ta có 1 khái niệm mới, là giao diện. Giao diện ra đời chính là để giải quyết đa kế thừa. Mỗi lớp trong Java chỉ có 1 lớp cha, nhưng có thể implements nhiều giao diện.
Giao diện được khai báo giống như 1 lớp, cũng có state và behavior. Nhưng state của giao diện là final còn behavior là abstract
Giả sử, ta sẽ khai báo một giao diện
12345678910publicinterfaceProduct {// hai state duoi day la final, tuc la lop implements khong duoc phep doi// gia tristaticstring maker ="My Corp";staticstring phone ="555-7767";// behavior duoi day la abstract, tuc la khong co noi dungpublicintgetPrice(intid);}
JAVA 3
Bài 5 - Lập trình OOP (Hướng đối tượng trong java)
Đây là một class, class này có hai property (thuộc tính) là name và age
12345publicclassPerson {String name;intage;}










