在Java编译器中,System.out.print中的打印可以定义为标识符或关键字? [英] In Java compiler,The print in System.out.print can be defined as identifier or Keyword?

查看:280
本文介绍了在Java编译器中,System.out.print中的打印可以定义为标识符或关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我研究了有关Java的知识,其中列出了50个Java关键字. Lex有一项作业,目的是识别单词是关键字,ID,符号,运算符.但是还有一个小问题是下面的代码,System.out.print()中的print是ID还是关键字?

I have studied about java which have listed 50 Java keywords. There is a homework of Lex, the goal is to recognize the word is keywords, IDs, symbols, operators. But there is one more little problem is the code below, is print in System.out.print() an ID or keyword?

 public class HelloWorld {
    public static int add(int a, int b) {
    return a + b;
    }
    public static void main(String[] args) {
        int c;
        int a = 5;
        c = add(a, 10);
        if (c > 10)
            System.out.print("c = " + -c);
        else
            System.out.print(c);
        System.out.print("Hello World");
        }
}

推荐答案

print是java.io.PrintStream类中方法的名称,因此是ID.关键字是在大多数IDE中键入它们时通常会变成蓝色或另一种颜色的关键字.

print is the name of a method in the java.io.PrintStream class, hence an ID. Keywords are those which generally turn blue or another colour when you type them in most IDEs.

有关更多信息: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/index.html

这篇关于在Java编译器中,System.out.print中的打印可以定义为标识符或关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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