Skip to content

Instantly share code, notes, and snippets.

@ucchyocean
Created July 6, 2016 03:45
Show Gist options
  • Save ucchyocean/133c736a4c53f9b0223cfc524afd825a to your computer and use it in GitHub Desktop.
Save ucchyocean/133c736a4c53f9b0223cfc524afd825a to your computer and use it in GitHub Desktop.
基本データ型とボクシング型の違い
package test;
public class BoxingTester {
public static void main(String[] args) {
boolean b1 = new Boolean(true);
boolean b2 = new Boolean(true);
System.out.println("b1 == b2 はどうなるの?:" + (b1 == b2));
Boolean bool1 = new Boolean(true);
Boolean bool2 = new Boolean(true);
System.out.println("bool1 == bool2 はどうなるの?:" + (bool1 == bool2));
}
}
@ucchyocean
Copy link
Author

実行結果

b1 == b2       はどうなるの?:true
bool1 == bool2 はどうなるの?:false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment