0% found this document useful (0 votes)
6 views1 page

Java Tricks: No Semicolon Code Examples

This document discusses various ways to perform arithmetic operations and control flow statements in Java without using certain common operators or syntax. It provides examples of printing without a semicolon, executing if/else blocks, performing addition without the + operator by using negation, and performing subtraction without the - operator by using bitwise complement. The examples demonstrate how to achieve the same results through alternative means when certain standard language features are unavailable or forbidden.

Uploaded by

Arabinda Mohanty
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)
6 views1 page

Java Tricks: No Semicolon Code Examples

This document discusses various ways to perform arithmetic operations and control flow statements in Java without using certain common operators or syntax. It provides examples of printing without a semicolon, executing if/else blocks, performing addition without the + operator by using negation, and performing subtraction without the - operator by using bitwise complement. The examples demonstrate how to achieve the same results through alternative means when certain standard language features are unavailable or forbidden.

Uploaded by

Arabinda Mohanty
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

Write a program without using semicolon(;)?

Print a semicolon with out semicolon?

How to execute both if and else

if ([Link]("Hello abc ians\n") == null) {

} else {
[Link]("hello spiderman\n");
}

int a = 5;
int x = a++;
int y = ++a;
[Link](x);
[Link](y);
o/p5,7
Performing addition without using addition operatior
int a = 12;
int b = 12;
int c = a -(- b);
[Link](c);
Performing substraction without using substrraction operatior
int a = 12;
int b = 12;
int c = a+~b+1;
[Link](c);

You might also like