【问题标题】:Why Semicolon is used in every statement, variable declaration in Java ? How much memory is consumed for semicolon characterWhy Semicolon is used in every statement, variable declaration in Java ? How much memory is consumed for semicolon character
【发布时间】:2022-12-27 21:52:03
【问题描述】:

I want to understand the use of semicolon in Java expressions, statements, expressions or in for loop? and I want to know what is the memory consumption for the semicolon.

int a = 1;
for(int a=0; a <1;a++)

etc

If I remove the semicolon gives below errors

java: ';' expected

【问题讨论】:

  • A semicolon is used to end an expression statement. The language says you need one, so why are you surprised when you get a syntax error by omitting it? About memory usage, what do you mean?

标签: java syntax


【解决方案1】:

The semicolon is the statement delimiter. It's not part of the instructions, it separates them. It's just a hint to the compiler, it doesn't generate any code in itself.

Generally speaking, there's no relation between the length of the source code and the size of the binary file, particularly because the length of thevisiblesource code is typically much smaller than that of all the libraries used.

【讨论】:

    猜你喜欢
    • 2022-12-02
    • 2022-12-02
    • 2022-11-20
    • 2022-12-02
    • 1970-01-01
    • 2022-11-20
    • 2022-12-31
    • 2022-12-19
    • 2012-05-14
    相关资源
    最近更新 更多