We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43314f5 commit dfc025dCopy full SHA for dfc025d
src/javaSpecific/guessTheOutput/TildeMathematics.java
@@ -1,7 +1,14 @@
1
package javaSpecific.guessTheOutput;
2
3
+// -x = ~x + 1;
4
+// -~x = x + 1 (by replacing x by ~x)
5
public class TildeMathematics {
6
public static void main(String[] args) {
7
+ System.out.println(~-9); // 8
8
+ System.out.println(~-100); // 99
9
+ System.out.println(~-1); // 0
10
+ System.out.println(~-0); // -1
11
+
12
System.out.println(~9); // -10
13
System.out.println(~100); // -101
14
System.out.println(~1); // -2
0 commit comments