有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (2) 个答案

  1. # 1 楼答案

    是的,有

    this JavaWorld article你可以自己用谷歌搜索一下!):

    static final int length = 25;
    static final int width = 10;
    int res = length * width;
    

    Execution time is not used to multiply those values; instead, multiplication is done at compile time. The code for the following variable assignment is modified to produce bytecode that represents the product of width and length:

    int res  = 250;
    
  2. # 2 楼答案

    Constant folding is the process of simplifying constant expressions at compile time. Terms in constant expressions are typically simple literals, such as the integer 2, but can also be variables whose values are never modified, or variables explicitly marked as constant

    是的,它存在于Java:Compiler optimizations