[英]I can't seem to figure out why I keep getting true when I clearly overridden the equality method
[英]I can't seem to find out why I keep getting the error "Invalid method declaration; return type required"
我正在嘗試制作 UUID 類型的字段...
public class Music {
private final UUID singerID;
private final UUID musicID;
Singer() {
this.singerID = UUID.randomUUID();
}
Music() {
this.musicID = UUID.randomUUID();
}
}
而且我在Singer() {
我對 java 很陌生,已經有 2 周了,所以如果你能 go 對我來說慢一點,那對我來說意義重大!
當 class 是 Music 時,您正在使用 Singer() 的構造函數語法。
將您的代碼更改為並刪除 Singer() 構造函數,
public Music() {
this.musicID = UUID.randomUUID();
this.singerID = UUID.randomUUID();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.