Possible Duplicate:
What is the difference between java.lang.Void and void?Đặt các loại chung của SwingWorker làm mất hiệu lực?
Tôi muốn tạo lớp bê tông cho SwingWorker
với cả loại kết quả cuối cùng và trung gian là void
. Tôi đã viết đoạn mã sau:
class AnswerWorker extends SwingWorker<void, void> {
protected void doInBackGround() {
System.out.println("what is your problem!!");
}
}
này đã cho tôi được lỗi sau:
Multiple markers at this line-
Syntax error on token "void", Dimensions expected after this token.
Syntax error on token "void", Dimensions expected after this token.
Tuy nhiên khi tôi đã thay đổi mã từ void
để Void
(ví dụ nhỏ v
vốn V
), nó làm việc tốt, mặc dù tôi vẫn bị buộc phải return null;
vào cuối phương thức doInBackground()
.
Tại sao điều này? Tôi biết Void
là một lớp học trong gói java.lang
nhưng tài liệu không nói nhiều về nó (ít nhất là tôi không thể theo dõi: p)
Thanx trước !!
và quan trọng có thể là hai tham số, có thực sự –
mKorbel