Java:Return type for the method is missing

 时间:2024-10-11 21:04:35

1、在编写类的方法时,我们知道要构造一个无参方法

Java:Return type for the method is missing

2、这里是无参构造方法,还可以加入参数构成方法重载

Java:Return type for the method is missing

3、但是当我们构造完后,居然报错了,鼠标一上去提示Return type for the method is missing!!

Java:Return type for the method is missing

4、其实时因为我们把方法名称设置错了,这是我们先去看一下类名称是什么

Java:Return type for the method is missing

5、这时我们找到类名称为C,只需要把方法名称也改为C就行,也就是方法名称与类名称保持一致

Java:Return type for the method is missing

6、修改后就可以发现程序的错误已经骈禄笫杳解决了,只要方法名称与类名称保持一致就可以。最后我们加上注释,做一下笔记,防止以后出现类似错误。

Java:Return type for the method is missing
  • 教你轻松做出分数转换二进制
  • crc生成多项式怎么算?
  • 平均周转时间怎么算
  • 数据库中主键、主码、主属性、关键字、候选关键字、码的区别
  • 在netbeans中怎样替换内容
  • 热门搜索
    夏天怎么减肥 碧生源减肥茶 燕麦片怎样吃减肥 减肥药排行榜第一名 东风标致怎么样 乳晕大怎么回事 减肥舞 红烧土豆片 怎么治疗痤疮 红烧丸子的家常做法