在Java中,方法/构造函数声明是否可以出现在另一个方法/构造函数声明中? [英] In Java, can a method/constructor declaration appear inside another method/constructor declaration?

查看:154
本文介绍了在Java中,方法/构造函数声明是否可以出现在另一个方法/构造函数声明中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java中,方法/构造函数声明是否可以出现在另一个方法/构造函数声明中?示例:

  void A(){
int B(){}
}



我想没有,但我很想得到安慰。

解决方案

。它是不可编译的。




In Java, can a method/constructor declaration appear inside another method/constructor declaration? Example:

void A() { 
    int B() { }
}

I think not, but I'd love to be reassured.

解决方案

No. it is not compilable.

这篇关于在Java中,方法/构造函数声明是否可以出现在另一个方法/构造函数声明中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆