java <<、>>、>>>

本文详细介绍了位运算符的使用方法,包括左移运算符(<<)和两种右移运算符(>> 和 >>>)。通过具体的例子解释了这些运算符如何影响二进制数,并展示了在不同情况下(特别是对于负数)右移运算符的不同行为。此外,还提供了Java中逻辑或(|)与条件或(||)、逻辑与(&)与条件与(&&)的区别链接。

<<:左移运算符,num << 1,相当于乘以2

:右移运算符,num >> 1,移一位相当于除2取商
右移后,正数补0,负数补1。

:无符号右移,忽略符号位,空位都以0补齐

没有<<<这种运算符,因为左移都是补零,没有正负数的区别。

如 -12 的二进制为:1111 1111 1111 1111 1111 1111 1111 0100;

-12 >> 3 即带符号右移3位,结果是:1111 1111 1111 1111 1111 1111 1111 1110,十进制为: -2;

-12 >>> 3 就是右移三位,前面补零,为:0001 1111 1111 1111 1111 1111 1111 1110,十进制为:536870910。

java中的|与||,&与&&的区别,与、或,非、异或、位运算:https://blog.youkuaiyun.com/u014306354/article/details/51181895

这段配置通常是在 `spring-boot-maven-plugin` 插件的 `<configuration>` 标签内使用,下面分别解释 `<includeSystemScope>true</includeSystemScope>` `<mainClass>LegouECommerceApplicationTests.java</mainClass>` 的含义用途。 ### `<includeSystemScope>true</includeSystemScope>` `includeSystemScope` 是 `spring-boot-maven-plugin` 插件的一个配置属性,当设置为 `true` 时,意味着在打包过程中会包含系统作用域(`system` scope)的依赖项。在Maven中,系统作用域的依赖项通常是本地文件系统上的特定文件,而不是从Maven仓库中获取的。默认情况下,`spring-boot-maven-plugin` 不会包含系统作用域的依赖项到最终的可执行JAR或WAR文件中。设置 `includeSystemScope` 为 `true` 可以确保这些系统作用域的依赖项也被正确地打包到最终的应用程序包中 [^1]。 ### `<mainClass>LegouECommerceApplicationTests.java</mainClass>` `mainClass` 属性用于指定Spring Boot应用程序的主类,即包含 `main` 方法的类。在启动Spring Boot应用程序时,Java虚拟机(JVM)会从这个主类开始执行。这里指定的 `LegouECommerceApplicationTests.java` 应该是包含 `main` 方法的类名,但需要注意的是,通常测试类(以 `Tests` 结尾的类)不应该作为主类,因为测试类主要用于编写运行单元测试或集成测试,而不是作为应用程序的入口点。正确的做法是指定包含 `main` 方法的主应用类,例如 `LegouECommerceApplication.java` [^1]。 示例配置如下: ```xml <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <includeSystemScope>true</includeSystemScope> <mainClass>com.example.LegouECommerceApplication</mainClass> </configuration> </plugin> </plugins> </build> ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值