Created
July 1, 2010 03:25
-
-
Save johobemax/459527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Enzan | |
{ | |
public static void main(String[] args) | |
{ | |
int a = Integer.parseInt(args[0]); | |
int b = Integer.parseInt(args[1]); | |
System.out.println("a="+a); | |
System.out.println("b="+b); | |
//算術演算子 | |
System.out.println("a+b="+(a+b)); //加算 | |
System.out.println("a-b="+(a-b)); //減算 | |
System.out.println("a*b="+(a*b)); //乗算 | |
System.out.println("a/b="+(a/b)); //除算 | |
System.out.println("a%b="+(a%b)); //剰余(余り) | |
//シフト演算子 | |
System.out.println("a<<b="+(a<<b)); //左論理シフト | |
System.out.println("a>>b="+(a>>b)); //右算術シフト | |
System.out.println("a>>>b="+(a>>>b)); //右論理シフト | |
//ビット演算子(補数) | |
System.out.println("~a="+~a); //1の補数(ビット反転) | |
System.out.println("~a+1="+(~a+1)); //2の補数(符号逆転) | |
//比較演算子 | |
System.out.println("a>b="+(a>b)); //大なり | |
System.out.println("a>=b="+(a>=b)); //以上 | |
System.out.println("a<b="+(a<b)); //小なり | |
System.out.println("a<=b="+(a<=b)); //以下 | |
System.out.println("a==b="+(a==b)); //等価 | |
System.out.println("a!=b="+(a!=b)); //不等価 | |
System.out.println("a&b="+(a&b)); //ビットand | |
System.out.println("a^b="+(a^b)); //ビットxor | |
System.out.println("a|b="+(a|b)); //ビットor | |
System.out.println("a<b?a:b="+(a<b?a:b)); //条件演算子 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
比較演算子までの実験ソース