首页 > 其他 > 详细

<java基础学习>RE 基础语法

时间:2014-02-21 09:26:29      阅读:306      评论:0      收藏:0      [点我收藏+]
1 public class MyFirstJavaProgram{
2   public static void main(String[] args ){
3         System.out.println("Hello World");
4     }  
5 
6 }

大小写敏感(case sensitive)——Hello和hello在java中有着不同的意义

所有类名的首字母需为大写(upper case)

所有方法名首字母为小写(lower case)

文件名一般同类名 MyFirstJavaProgram.java

public static void main(String args[]) —— 程序的入口

java标识符(java identifiers)

  • All identifiers should begin with a letter (A to Z or a to z), currency character ($) or an underscore (_).

  • 标识符由A-Z 或 a-z,美元符,下划线为首 
  • After the first character identifiers can have any combination of characters.

  • 第一个标识符确定后,后面可以为任何字符
  • A key word cannot be used as an identifier.

  • 关键字不能作为标识符
  • Most importantly identifiers are case sensitive.

  • 大多数标识符是区分大小写
  • Examples of legal identifiers: age, $salary, _value, __1_value 正确例子

  • Examples of illegal identifiers: 123abc, -salary 错误例子

<java基础学习>RE 基础语法

原文:http://www.cnblogs.com/linuxroot/p/3558311.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!