Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
我们可以更简要地将您的班级定义为a 记录在Java 16+中。如果您的班级的主要目的是透明且不变地传达数据,则记录是合适的。编译器隐式创建构造函数,getters,
equals
&HashCode
和toString
。实例。注意24小时时钟。
您显然还没有掌握Java语言的基础知识。请在此处发布之前,请在此处学习您的教科书和其他资源。 Oracle提供 java教程 免费。
We can more briefly define your class as a record in Java 16+. A record is appropriate if the main purpose of your class is to communicate data transparently and immutably. The compiler implicitly creates the constructor, getters,
equals
&hashCode
, andtoString
.Instantiate. Pay attention to 24-hour clock.
You obviously have yet to master the basics of the Java language. Please study your textbook and other resources before posting here. Oracle provides the Java Tutorials free of cost.