-
Ai Fix Hộ VS
<div>
<div><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div>
<div><blockquote> package edu.java;
import java.util.scanner;
/**
*
* @author nguyenhuu
*/
public class sinhvien {
private string sbd,hotensv,addresssv,hocphan;
private float dthk1,dthk2;
scanner nhapdl=new scanner(system.in);
public sinhvien() {
sbd=this.sbd;
hotensv=this.hotensv;
addresssv=this.addresssv;
hocphan=this.hocphan;
dthk1=this.dthk1;
dthk2=this.dthk2;
}
public string getsbd() {
return sbd;
}
public void setsbd(string sbd) {
this.sbd = sbd;
}
public string gethotensv() {
return hotensv;
}
public void sethotensv(string hotensv) {
this.hotensv = hotensv;
}
public string getaddresssv() {
return addresssv;
}
public void setaddresssv(string addresssv) {
this.addresssv = addresssv;
}
public string gethocphan() {
return hocphan;
}
public void sethocphan(string hocphan) {
this.hocphan = hocphan;
}
public float getdthk1() {
return dthk1;
}
public void setdthk1(float dthk1) {
this.dthk1 = dthk1;
}
public float getdthk2() {
return dthk1;
}
public void setdthk2(float dthk1) {
this.dthk1 = dthk1;
}
public void nhaptt(){
system.out.print("nhap tt sbd : ");
setsbd(nhapdl.nextline());
system.out.print(" nhap tt ho ten : ");
sethotensv(nhapdl.nextline());
system.out.print("nhap tt address : ");
setaddresssv(nhapdl.nextline());
system.out.print(" nhap tt hoc phan : ");
sethocphan(nhapdl.nextline());
system.out.print(" nhap diem thi hk1 : ");
setdthk1(nhapdl.nextfloat());
system.out.print("nhap diem thi hk2 : ");
setdthk2(nhapdl.nextfloat());
}
public void showtt(){
system.out.println(" sbd "+getsbd());
system.out.println("ho ten "+gethotensv());
system.out.println("address "+getaddresssv());
system.out.println("tt hoc phan "+gethocphan());
system.out.println(" diem thi hk1 "+getdthk1());
system.out.println("diem thi dk2 "+getdthk2());
}
}
</blockquote></div>
</div>
</div>
<div>
<div><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div>
<div><blockquote>/*
* to change this template, choose tools | templates
* and open the template in the editor.
*/
package edu.java;
import java.util.scanner;
/**
*
* @author nguyenhuu
*/
public class cau3{
/**
* @param args the command line arguments
*/
int n;
sinhvien [] qlsinhvien=new sinhvien[n];
scanner nhapdl=new scanner(system.in);
public void nhapttsv(){
system.out.print(" nhap vao so sinh vien n = ");
n = nhapdl.nextint();
qlsinhvien=new sinhvien[n];
system.out.println("");
for (int i = 0; i <=(qlsinhvien.length-1); i++) {
qlsinhvien.nhaptt();
}
}
public void showttsv(){
system.out.println("hien thi danh sach thong tin sv : ");
for (int i = 0; i <=(qlsinhvien.length-1); i++) {
qlsinhvien.showtt();
}
}
public static void main(string[] args) {
// todo code application logic here
cau3 a= new cau3();
a.nhapttsv();
a.showttsv();
}
}
</blockquote></div>
</div>
</div>
khi chạy báo java.lang.nullpointerexception ở phần nhapttsv(); ai chỉ cách fix lỗi này vs. thankss
-
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
-
Nội quy - Quy định
Dự án Ascent Lakeside xây dựng bởi Tiến Phát Corp sông nước bao quanh vốn khổng lồ lựa chọn hàng đầu. dự án Ascent Lakeside sông nước bao quanh khu trung tâm không khí trong lành. Chung cư cao cấp...
Dự án Ascent Lakeside sống nhộp nhịp