I just started programming, so I'm sorry if you're saying something strange.
I'd like to add a new setName method to the Person class (the getName and getAge methods are defined), but how can I do it without a return value?
java
Person Class (getName and getAge methods are defined)
If is referring to the following conditions:
public class Person {
private String name;
private age;
public String getName() {
return name;
}
public int getAge(){
return;
}
}
The code is as follows:
public class Person {
private String name;
private age;
public String getName() {
return name;
}
public int getAge(){
return;
}
// Additional parts from here
public void setName(String name){
this.name = name;
}
public void setAge(interage){
This.age=age;
}
}
void
indicates no return value.
529 Uncaught (inpromise) Error on Electron: An object could not be cloned
547 Who developed the "avformat-59.dll" that comes with FFmpeg?
547 PHP ssh2_scp_send fails to send files as intended
697 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
546 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.