This week learning about some of the arithmetic operation, I had to write and run the program, the code is as follows:
public class TestSign{
public static void main(String[] args){
int j = 10,k = 20;
int i = j++;
System.out.print(“i=”+i); //i=10
System.out.println(“j=”+j);//j=11
i = ++j;
System.out.print(“i=”+i);//i=12
System.out.println(“j=”+j);//j=10 11 12 13
i = k--;
System.out.print(“i=”+i);//i=20
System.out.println(“k=”+k);//k=19
i = --k;
System.out.print(“i=”+i);//i=18
System.out.println(“k=”+k);//k=18
}
}
package test;
Test class {public
public static void main (String [] args) {
// logical operators
System.out.println (4 == 4 & 1 == 1); // Output ture
System.out.println (. 4 == ! 4 || 1 = 1); // output ture
// bitwise operators
System.out.println (1 << 2); 2-th power of 2 * 1 //
System.out.println (3 << 3) ; //. 3 * 2 * 2 * 2 = 24
System.out.println (>>. 8. 3); //. 8 * 0.5 * 0.5 * 0.5 =. 1
System.out.println (&. 6. 3); // output 2
System.out.println (6 | 3); // output 7
// ternary operator
int K = 2;
int I = K> 0 2:. 3;?
System.out.println (I); // I = 2
}
}
This week is not too much use, did not make good use of time, next week must not repeat the same mistakes!