java只是花括号 [英] java just curly braces

查看:99
本文介绍了java只是花括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在读一本书,有一些例子只有大括号的程序

I was reading a book and there were a few example with programs that has just curly braces

例如

 public static void main(String args[]){
     //what is the uses of curly braces here.
     {
          //some code
     }
 }


推荐答案

这是一个代码块。在那里声明的变量在上面的块中是不可见的(这些curlies之外的方法体),即它们的范围更有限。

It's a code block. The variables declared in there are not visible in the upper block (method body outside of these curlies), i.e. they have a more limited scope.

这篇关于java只是花括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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