[問答題] 下面程序是關(guān)于位運算符的使用。請在程序的每條橫線處填寫一個位運算符,使程序的功能完整。 注意:請勿改動main()主方法和其他已有的語句內(nèi)容,僅在
2021-07-20
[問答題] 下面程序是關(guān)于位運算符的使用。請在程序的每條橫線處填寫一個位運算符,使程序的功能完整。
注意:請勿改動main()主方法和其他已有的語句內(nèi)容,僅在橫線處填人適當(dāng)?shù)奈贿\算符。
public class BitOperator
public static void main(String args[])
int a=9;//二進(jìn)制數(shù)1001
int b=15;//二進(jìn)制數(shù)1111
int c=8;//二進(jìn)制數(shù)1000
int d,e,f,g,h;
d=a__________b;//二進(jìn)制數(shù)1001,也就是十進(jìn)制數(shù)9
e=a|b;//二進(jìn)制數(shù)1111,也就是十進(jìn)制數(shù)15
f=a__________b;//二進(jìn)制數(shù)0110,也就是十進(jìn)制數(shù)6
g=a<<2;//9×4=36
h=c__________1;//8/2=4
System.out.println("d="+d);
System.out.println("e="+e);
System.out.println("f="+f);
System.out.println("g="+g);
System.out.println("h="+h);
正確答案:& ^ >>
詞條內(nèi)容僅供參考,如果您需要解決具體問題
(尤其在法律、醫(yī)學(xué)等領(lǐng)域),建議您咨詢相關(guān)領(lǐng)域?qū)I(yè)人士。