⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compareprimitive.java

📁 主要是对于JAVA的编程的基本语言 希望能够帮得上你。
💻 JAVA
字号:
package Operator;

/*
 Equality for primitives 
 Most programmers are familiar with comparing primitive values. 
 The following code shows some primitives being compared for equality:
*/

class ComparePrimitives {
   public static void main(String [] args) {	  
      System.out.println("character 'a' == 'a'? " + ('a' == 'a'));
      System.out.println("character 'a' == 'b'? " + ('a' == 'b'));
      System.out.println("5 != 6? " + (5 != 6));
      System.out.println("5.0 == 5L? " + (5.0 == 5L));
      System.out.println("true == false? " + (true == false));
      System.out.println("true != false? " + (true != false));
   }
}

/*
 Notice that in line six we are comparing an integer to a float number. 
 This program produces the following output:
 
 character 'a' == 'a'? true
 character 'a' == 'b'? false
 5 != 6? true
 5.0 == 5L? true
 true == false? false
 
 As we can see, if a float is compared with an integer and
 the values are the same, the == operator returns true as expected. 
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -