gpt4 book ai didi

java - 为什么 java 允许具有类名和类型 void 的方法

转载 作者:太空狗 更新时间:2023-10-29 22:53:41 24 4
gpt4 key购买 nike

<分区>

Java 允许创建具有类名和类型 void 的方法(类似于 void 构造函数)。构造函数没有类型,它执行构造函数的功能。但是有没有使用上面提到的那种方法。你能举例说明这些用法吗

示例代码:

//my class
class MyClass{

//constructor
public MyClass(.....){
}

//What is the use of the below method
public void MyClass(....){
}
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com