Increment a number without using ++ or + | Java program to increment an unsigned char using bitwise operators . ; function that increment the value . ; Invert bits and apply negative sign ; Driver code
class GFG { static char increment ( char i ) { int i1 = - ( ~ ( int ) ( i ) ) ; return ( char ) ( i1 ) ; } public static void main ( String [ ] args ) { char n = ' a ' ; System . out . println ( increment ( n ) ) ; } }