Mã:
class sinhvien {
private string hoten;
private int namsinh;
private float diemtb;
private string lop;
public sinhvien() {
}
public sinhvien(string hoten, int namsinh) {
this.hoten = hoten;
this.namsinh = namsinh;
this.lop = "at7a";
system.out.println("họ tên: " + this.hoten + " năm sinh: " + this.namsinh);
system.out.println("lớp: " + this.lop);
}
//overloading constructor method
public sinhvien(string hoten, int namsinh, float diemtb) {
this.hoten = hoten;
this.namsinh = namsinh;
this.diemtb = diemtb;
this.lop = "at7a";
system.out.println("họ tên: " + this.hoten + " năm sinh: " + this.namsinh + " điểm trung bình: " + this.diemtb);
system.out.println("lớp: " + this.lop);
}
}
public class javaandroidvn {
public static void main(string[] args) {
sinhvien a = new sinhvien("vũ văn t", 1992);
sinhvien b = new sinhvien("nguyen van tung", 1994, 9.0f);
}
}
mình mới học về java nên có gì sai mọi người giúp nhé
ở hàm main "sinhvien a = new sinhvien("vũ văn t", 1992);"
có cách nào để mình lấy output của người dùng không ạ.?
vd:"sinhvien a = new sinhvien(string name, int year);" và em muốn cho nó vào vòng for để tạo 1 bảng ạ khi in ra "sout"
Trứng rung điều khiển từ xa Vibrator Spark Of Love Sản phẩm trứng rung bluetooth có điều khiển từ xa này được thiết kế với tông màu Rose Gold viền kim loại qua. Kích thước 7,4cm x 3,5cm giúp trứng...
TOP 3 trùy rung không dây cực kích thích cho phụ nữ