Upload files to "OOP/Java/Lab/Week2"
This commit is contained in:
parent
730413c501
commit
40f695b27c
5 changed files with 129 additions and 0 deletions
28
OOP/Java/Lab/Week2/Operators.java
Normal file
28
OOP/Java/Lab/Week2/Operators.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
import java.util.Scanner;
|
||||
public class Operators {
|
||||
|
||||
public static void main(String args[]){
|
||||
|
||||
Scanner sc = new Scanner(System.in);
|
||||
|
||||
System.out.println("Enter the value of a:");
|
||||
int a = sc.nextInt();
|
||||
|
||||
System.out.println("Enter the value of b:");
|
||||
int b = sc.nextInt();
|
||||
|
||||
int c = (a<<2) + (b>>2);
|
||||
System.out.println("Output of (a<<2) + (b>>2) is: "+c);
|
||||
|
||||
boolean d = (b > 0);
|
||||
System.out.println("Output of (b>0) is: "+d);
|
||||
|
||||
int e = (a + b * 100) / 10;
|
||||
System.out.println("Output of ((a + b * 100) / 10) is: "+e);
|
||||
|
||||
int f = a & b;
|
||||
System.out.println("Output of (a & b) is: "+f);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue