JLS在这里不会“提升到更大的数据类型”,因为它不会为转移运算符执行二进制数字提升.这由

JLS, Section 15.19涵盖.

Unary numeric promotion (§5.6.1) is performed on each operand separately. (Binary numeric promotion (§5.6.2) is not performed on the operands.)

一元数字促销将字节a提升为int.文字4L没有改变,但无论如何它只需要是一个整体类型.

It is a compile-time error if the type of each of the operands of a shift operator, after unary numeric promotion, is not a primitive integral type.

然后,对于移位,仅使用至少5个有效位来移位int.

If the promoted type of the left-hand operand is int, then only the five lowest-order bits of the right-hand operand are used as the shift distance. It is as if the right-hand operand were subjected to a bitwise logical AND operator & (§15.22.1) with the mask value 0x1f (0b11111). The shift distance actually used is therefore always in the range 0 to 31, inclusive.

运算符的结果是int,而不是long,因此可以在没有编译器错误的情况下将其赋值给int.

The type of the shift expression is the promoted type of the left-hand operand.

促销 java_原始促销 [Java]相关推荐

  1. 初始化 数组 java_如何用Java初始化数组

    初始化 数组 java Today we will learn how to initialize an array in java. An array in java is a container ...

  2. md4 java_求MD4 java实现的代码

    展开全部 //以下为直接复制粘帖过来的 import java.lang.reflect.*; /************************************************ MD ...

  3. 字符串压缩 java_如何在Java中压缩字符串?

    如何在Java中压缩字符串? 我使用GZIPOutputStream或ZIPOutputStream压缩字符串(我的2222235278130938882小于20),但压缩结果比原始字符串长. 在某个 ...

  4. volite java_如何理解 JAVA volatile 关键字

    最近在重新梳理多线程,同步相关的知识点.关于 volatile 关键字阅读了好多博客文章,发现质量高适合小白的不多,最终找到一篇英文的非常通俗易懂.所以学习过程中顺手翻译下来,一方面巩固知识,一方面希 ...

  5. 手写java_手写JAVA虚拟机(二)——实现java命令行

    咱们都知道,咱们编译.java并运转.class文件时,需求一些java指令,如最简略的helloworld程序.java初学者可以看一下下面的教程. 这儿的程序最好不要加包名,因为加了包名的话编译和 ...

  6. 【Java_基础】Java中Native关键字的作用

    本篇博文转载与:Java中Native关键字的作用 转载于:https://www.cnblogs.com/leiblog/p/10529056.html

  7. 第一个java_第一个java程序

    要想在自己电脑上运行一个Java程序,首先要安装Java的jdk,网上有很多的安装教程,这篇文章写的比较详细,可以参考.https://blog.csdn.net/qq_35246620/articl ...

  8. 日期如何比较 java_如何比较Java中的日期?

    Basil Bourqu.. 30 TL;博士 LocalDate today = LocalDate.now( ZoneId.of( "America/Montreal" ) ) ...

  9. Java_异常_03_ java.lang.NoClassDefFoundError: org/apache/commons/pool/KeyedObjectPoolFactory

    异常信息: java.lang.NoClassDefFoundError: org/apache/commons/pool/KeyedObjectPoolFactory 原因: 我用的是commons ...

最新文章

  1. 为什么你问问题,别人都已读不回?
  2. android w700
  3. 基于区块链的健康链系统设计与实现(6)结束语
  4. 训练softmax分类器实例_第四章.模型训练
  5. Flask框架项目实例:**租房网站(二)
  6. 英语口语练习软件测试简历,软件测试员英语简历范文
  7. Apache Flink新场景——OLAP引擎
  8. MobileNet-v3详解
  9. 红薯叶有什么营养价值?
  10. leetcode-Easy-第1期:two sum
  11. 《众妙之门 JavaScript与jQuery技术精粹》 - 读书笔记总结[无章节版][1-60]
  12. 用MediaCreationTool制作WINDOWS10安装U盘
  13. MAC安装HBase
  14. JS实现div随鼠标移动练习
  15. Axis2 WS-Security 签名和加密
  16. 高通平台调整通话音量
  17. uvm设计分析——reg
  18. Linux(Centos7) 报 “RTNETLINK answers: File exists” 问题的解决
  19. vue2.5去哪儿(慕课网)学习笔记
  20. Unreal4 入门(安装)

热门文章

  1. java ++i、i++、i++ + ++i、i++ + i++原理
  2. ContextLoaderListener介绍
  3. 深度学习目标检测之 YOLO v4
  4. Docker 精通之常用命令
  5. spring boot security 权限用postman测试_Spring Security(五):前后端权限控制详解
  6. fck java_FCkjava三种调用方法
  7. 最近在ST公司的STxp70的dsp平台上开发音频codec模块.
  8. 应用程序池优化配置方案(IIS7、IIS7.5)
  9. 11月16日 个人战立会议内容报告
  10. Spring Boot之自定义属性