0% found this document useful (0 votes)
4 views2 pages

Java Programs With Output

The document presents several Java programs with their corresponding outputs. It includes examples such as adding two numbers, checking number ranges, finding the maximum of two numbers, and performing bitwise operations. Additionally, it demonstrates left and right shift operations on a number.

Uploaded by

manimaranedu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Java Programs With Output

The document presents several Java programs with their corresponding outputs. It includes examples such as adding two numbers, checking number ranges, finding the maximum of two numbers, and performing bitwise operations. Additionally, it demonstrates left and right shift operations on a number.

Uploaded by

manimaranedu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Java Programs and Actual Output

1. Add Two Numbers using +=


Code:
int a = 10;
int b = 5;
a += b;

Output:
Sum = 15

2. Check if number is greater than 10 and less than 50


Input:
num = 25

Output:
Number is greater than 10 and less than 50

3. Maximum of two numbers using ternary operator


Input:
a = 15, b = 20

Output:
Maximum = 20

4. Bitwise AND and OR


Input:
a = 6, b = 3

Output:
Bitwise AND = 2
Bitwise OR = 7

5. Left Shift and Right Shift


Input:
num = 8
Output:
Left Shift = 16
Right Shift = 4

You might also like