zoukankan      html  css  js  c++  java
  • java关键字 保留字

    Java 关键字和保留字

    Java 关键字列表 (依字母排序 共51组):
    abstract, assert,boolean, break, byte, case, catch, char, class, const, continue, default, do, double, else, enum,extends, final, finally, float, for, if, implements, import, instanceof, int, interface, long, native, new, package, private, protected, public, return, short, static, strictfp, super, switch, synchronized, this, throw, throws, transient, try, void, volatile, while
    Java
    保留字列表 (依字母排序 共14组) : Java保留字是指现有Java版本尚未使用 但以后版本可能会作为关键字使用。
    byValue, cast, false, future, generic, inner, operator, outer, rest, true, var , goto ,const,null

    呵呵,不管别的,来几条题目先,作对了你牛^_^

      1, which of the following are keywords or reserved words in java?
      a) if b)then c)goto d)while e)case f)sizeof

      2, which of the following are java key words?
      a)double b)Switch c)then d)instanceof

      3, which of these are key words in java?
      a) default b)NULL c)String d)throws e)long f)true

      答案来了 1,acde 2,ad 3,adef 作对了吗^_^

      解释来了 1,then和sizeof都不是java的关键字,熟悉c或者c++,写惯了asp的高手就要小心喽。

      2,所有的关键字都是小写的,所以Switch不是关键字。instanceof看上去像方法名,但其实是关键字;

      3,大写的NULL不是java语言的关键字。String是java语言的一个封装类的类名,也不是关键字。

      再来点系统的:

      正确识别java语言的关键字(keyword)和保留字(reserved word)是十分重要的。Java的关键字对java的编译器有特殊的意义,他们用来表示一种数据类型,或者表示程序的结构等。保留字是为java预留的关键字,他们虽然现在没有作为关键字,但在以后的升级版本中有可能作为关键字。

      关键字列表

      abstract boolean break byte case
      catch char class continue default
      do double else extends false
      final finally float for if
      implements import instanceof int interface
      long native new null package
      private protected public return short
      static super switch synchronized this
      throw throws transient true try
      void volatile while
      
      保留字
      const,goto

      注意点

      识别java语言的关键字,不要和其他语言如c/c++的关键字混淆。

      const和goto是java的保留字。
      所有的关键字都是小写
      friendly,sizeof不是java的关键字

  • 相关阅读:
    根据判断PC浏览器类型和手机屏幕像素自动调用不同CSS的代码
    c#抓取网页内容乱码的解决方案
    C#中使用正则表达式提取超链接地址的集中方法
    sql server日期时间转字符串
    DataGridView直接导出EXCEL
    sql数据库删除表的外键约束(INSERT 语句与 FOREIGN KEY 约束"XXX"冲突。该冲突发生于数据库"XXX",表"XXX", column 'XXX)
    C#抓取页面时候,获取页面跳转后的地址
    HttpWebRequest 抓取页面异常处理办法
    JQuery的Ajax跨域请求的解决方案
    mysql 事物ACID和隔离级别
  • 原文地址:https://www.cnblogs.com/little-white/p/3325615.html
Copyright © 2011-2022 走看看