首页
话题
动态
专家
文章
作者
公告
更多
积分规则
登录 或 注册
首页
话题
动态
专家
文章
作者
公告
积分规则
发表新帖
发表新帖
Question about constructors in Java
前端
未结
关注
8
641
我寻月下人不归
2021-01-20 14:52
I have few questions regarding Java constructors
Can a constructor be private? If yes then in which condition?
Is a constructor a method or not?
8条回答
野趣味
(楼主)
2021-01-20 15:30
Constructor can be created as a private in any case.
Constructor is a special type of
method
which can be automatically called when we are creating object for the corresponding class.
Constructor does not contain any return values. It just create new objects. Should not provide any return type for constructor.
The default access specifier of the constructor is
public
0
讨论(0)
查看其它8个回答
发布评论:
提交评论
加载中...
验证码
看不清?
提交回复
热议问题