Linked Questions
45 questions linked to/from What does the ^ operator do in Java?
73 votes
5 answers
63k views
^ operator in java [duplicate]
Can anyone explain the use of ^ operator in java with some examples?
2 votes
2 answers
15k views
What does ^ (caret) mean in Java [duplicate]
What does the ^ (caret) mean in Java syntax? Why does 6^3 return 5?
0 votes
3 answers
524 views
why does 2^0 return 2 in java [duplicate]
Possible Duplicate: What does the ^ operator do in Java? The power ^ in Java? I am sorry if this is a duplicate, but i didn´t found anything in SO. So can someone explaint me why System....
0 votes
4 answers
624 views
What does the operator ^ stand for in java? [duplicate]
I just saw it in a code, so I tried this : int i = 30; System.out.println(i^3); Result is : 29 What is this ? Thanks.
3 votes
3 answers
917 views
Why is the output (Nan,Nan)? [duplicate]
So I'm new to Java and I have an assignment to do for class, but I'm stuck. The class is supposed to find the intersection of two lines using the quadratic equation. I was told to have specific inputs ...
-2 votes
1 answer
4k views
What is the difference between ** and ^ in python [duplicate]
In python if you want to sqaure an int you have to put ** but in java you put ^; But python didn't give me an error when I did ^ in my code It just gave me something with no pattern can anyone explain ...
0 votes
1 answer
2k views
How to calculate the sum of geometric series [duplicate]
I want to calculate the sum of a geometric series. ie: 1 , 5 , 25 , 125 , etc I try to use the math formula to calculate it: a(r^n -1)/(r-1) My code: int a = 1; int r = 5; int deno = r -1; int n = 3 ...
-1 votes
1 answer
2k views
How can i return true if 1 parameter is true and return false if the 2 parameters are true without using If-else statements [duplicate]
so , as the title says i have 2 ints where if (only) one of them is between (13 , 19) , return true but if both ints are between (13 , 19) return false without using if-else Statements sry if its a ...
0 votes
2 answers
128 views
Java keeps returning incorrect answer [duplicate]
a is the value of the spinner. private void toolCalculateActionPerformed(java.awt.event.ActionEvent evt) { Integer a = (int) toolSpinner.getValue(); if (toolEnch.getSelectedIndex() == 0) { ...
-1 votes
2 answers
146 views
Java ^ operator [duplicate]
Java programming. int i = 0; int j = 1; str.charAt(i) ^ str2.charAt(j) What does mean ^ operator in java? And what is this operator reverse operation? example w ^ . = 121 T ^ W = 35
-3 votes
3 answers
168 views
Heavy number corruption in floating point division in Java? [duplicate]
I have been trying to do something simple with java floating point division, have read several articles on some minimal changes on values but nothing like I am having below. This is the expected: ...
0 votes
1 answer
110 views
why does my output is wrong in exponents in java [duplicate]
why is it that this is wrong? i input the heightL as 2 the output must be 4 but there is something wrong class He{ public static void main(String[] args) { int heightL=2; int a = 9; ...
2 votes
3 answers
114 views
switch( i ^ 3). what does this mean? [duplicate]
I cannot understand to why this syntax does not generate any kind of compile time or run time errors ? int i=2; switch(i ^ 3){ ---- > this part case 8: System.out.print("Eight"); break; ...
-1 votes
1 answer
103 views
Math.sqrt one works one doesn't why? [duplicate]
Add the following method to the Point class: public double distance(Point other) Returns the distance between the current Point object and the given other Point object. The distance between two ...
-3 votes
2 answers
76 views
What is "^" operation in Java Program? [duplicate]
for(int i = 0; i < n; i++) { num += digits[i]*(10^(n-1-i)); System.out.println(10^(n-1-i)); } My purpose is to change a array representation of a number into Integer ...