Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
就我现在而言,我有这个:
类车辆{ int 注册号;
类车辆{
int 注册号;
现在我需要为 registrationNumber 创建一个构造函数。我该怎么做呢?(我见过一些this.= this.做什么?
this关键字返回对当前对象的引用。
class Vehicle{ int registrationNumber; Vehicle(int registrationNumber){ this.registrationNumber = registrationNumber; } }