java中数组风格讨论

i_Programmer 2012-08-17 06:41:36
java中的数组有这么两种风格:
int a[];
int[] a;

大家喜欢哪种风格呢?
...全文
172 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
游一游走一走 2012-08-27
  • 打赏
  • 举报
回复
没用过C只用JAVA的路过,在JAVA中数组是有其对应类型的,int[]-->对应于类型"[I",所以我习惯使用后面一种
断点 2012-08-27
  • 打赏
  • 举报
回复
习惯了C的方式
yqj2065 2012-08-26
  • 打赏
  • 举报
回复
唯一需要前者的情况,是一个语句声明多个变量时,
int i,arr[];
为啥呢 2012-08-19
  • 打赏
  • 举报
回复
发错了,我是说后一种
为啥呢 2012-08-19
  • 打赏
  • 举报
回复
我用前一种,因为思考顺序是:类型 数组 变量名
ZangXT 2012-08-17
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 的回复:]

各有喜好,主要是jvm都支持两种风格!
[/Quote]
跟jvm没有关系。
Ruanshenghao 2012-08-17
  • 打赏
  • 举报
回复
各有喜好,主要是jvm都支持两种风格!
i_Programmer 2012-08-17
  • 打赏
  • 举报
回复
引自《java核心技术 卷2(第8版)》:大多数java应用程序员喜欢“后一种”风格,因为它将类型int[](整型数组)与变量名分开了。
btbear 2012-08-17
  • 打赏
  • 举报
回复
还是前一种习惯 估计先学c的都会用前一种吧
小小X 2012-08-17
  • 打赏
  • 举报
回复
后一种好一点
龙四 2012-08-17
  • 打赏
  • 举报
回复
后一种是java的风格,前者是c风格

后一种应该用的更多些
Book Description Written for the moderately experienced Java programmer, this book builds on readers¿ existing knowledge of object-oriented programming and covers all important aspects of Standard C++—emphasizing more lower-level C-style details later in the presentation. Chapter topics include philosophy of C++, simplest C++, pointers and reference variables, object-based programming: classes, operator overloading, object-oriented programming: inheritance, templates, abnormal control flow, input and output, collections: the standard template library, primitive arrays and strings, C-style C++, and using Java and C++: the JNI. For new C++ programmers converted from Java. For experienced Java programmers and students who require the skills of C++ programming, best-selling author Mark Allen Weiss bridges the gap. He efficiently presents the complex C++ language in this well-designed tutorial/reference that both students and seasoned programmers will appreciate. The book is ideal as a primary text for intermediate C++ courses, as a supplemental no-nonsense reference for other courses, or for independent learning by professionals. C++ for Java Programmers is a concise, well-written text that provides authoritative and up-to-date coverage of key features and details of C++, with a special focus on how C++ compares to Java. The book's approach shows knowledgeable students or professionals how to grasp the complexities of C++ and harness its power by mutually addressing the benefits and the pitfalls of the two languages. By highlighting the features and comparative elements of each language, and building on the reader's existing knowledge of object-oriented programming, C++ for Java Programmers enables users to master the essentials of C++ quickly and thoroughly. Key Features Includes insightful comparisons of the two programming languages throughout the text and points out the subtleties of C++ Succinctly covers the pertinent highlights of STL (Standard Template Library) and the most effective use of templates Explains the use of the powerful JNI (Java Native Interface) for combining Java and C++ Includes a summary of key C++ features and issues with each chapter Provides extensive treatment of C details the programmer is likely to encounter in C++ Companion Website for complete online source code at: http://www.prenhall.com/weiss Available Instructors Resource CD-ROM Product Details Paperback: 304 pages Publisher: Prentice Hall; 1 edition (November 7, 2003) Language: English ISBN-10: 013919424X ISBN-13: 978-0139194245 Product Dimensions: 9.5 x 6.8 x 0.6 inches

51,395

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧