In Java (and most programming languages) you should not consider yourself to be writing equations but instructions:
= basically means make the left "thing" what the right "thing" currently is, or in the words of StormeHawke
the = operator in Java and most other programming languages should not mentally be read as "equals" but rather "is defined as"
so
x3= x - x2;
is valid because you can change x3 to be x - x2, but
x - x2 = x3;
is not valid because which thing on the left do you change: x, x2, or both?
This means that the following is a perfectly reasonable thing to write;
x=x+1;
As an equation this makes no sense, but as an instruction it makes perfect sense, its "make x equal to what x is now plus 1"
###Other issues
Other issues
- After solving this you will also find that
distanceTo()is defined as returning a double but doesn't, you need to return some "answer" or change its return to void - x3 is also not defined as "being" anything, it needs to be declared before/when its used, presumable as a double
In Java (and most programming languages) you should not consider yourself to be writing equations but instructions:
= basically means make the left "thing" what the right "thing" currently is, or in the words of StormeHawke
the = operator in Java and most other programming languages should not mentally be read as "equals" but rather "is defined as"
so
x3= x - x2;
is valid because you can change x3 to be x - x2, but
x - x2 = x3;
is not valid because which thing on the left do you change: x, x2, or both?
This means that the following is a perfectly reasonable thing to write;
x=x+1;
As an equation this makes no sense, but as an instruction it makes perfect sense, its "make x equal to what x is now plus 1"
###Other issues
- After solving this you will also find that
distanceTo()is defined as returning a double but doesn't, you need to return some "answer" or change its return to void - x3 is also not defined as "being" anything, it needs to be declared before/when its used, presumable as a double
In Java (and most programming languages) you should not consider yourself to be writing equations but instructions:
= basically means make the left "thing" what the right "thing" currently is, or in the words of StormeHawke
the = operator in Java and most other programming languages should not mentally be read as "equals" but rather "is defined as"
so
x3= x - x2;
is valid because you can change x3 to be x - x2, but
x - x2 = x3;
is not valid because which thing on the left do you change: x, x2, or both?
This means that the following is a perfectly reasonable thing to write;
x=x+1;
As an equation this makes no sense, but as an instruction it makes perfect sense, its "make x equal to what x is now plus 1"
Other issues
- After solving this you will also find that
distanceTo()is defined as returning a double but doesn't, you need to return some "answer" or change its return to void - x3 is also not defined as "being" anything, it needs to be declared before/when its used, presumable as a double
In Java (and most programming languages) you should not consider yourself to be writing equations but instructions:
= basically means make the left "thing" what the right "thing" currently is, or in the words of StormeHawke
the = operator in Java and most other programming languages should not mentally be read as "equals" but rather "is defined as"
so
x3= x - x2;
is valid because you can change x3 to be x - x2, but
x - x2 = x3;
is not valid because which thing on the left do you change: x, x2, or both?
This means that the following is a perfectly reasonable thing to write;
x=x+1;
As an equation this makes no sense, but as an instruction it makes perfect sense, its "make x equal to what x is now plus 1"
###Other issues
After solving this you will also find that distanceTo() is defined as returning a double but doesn't, you need to return some "answer" or change its return to void
- After solving this you will also find that
distanceTo()is defined as returning a double but doesn't, you need to return some "answer" or change its return to void - x3 is also not defined as "being" anything, it needs to be declared before/when its used, presumable as a double
In Java (and most programming languages) you should not consider yourself to be writing equations but instructions:
= basically means make the left "thing" what the right "thing" currently is, or in the words of StormeHawke
the = operator in Java and most other programming languages should not mentally be read as "equals" but rather "is defined as"
so
x3= x - x2;
is valid because you can change x3 to be x - x2, but
x - x2 = x3;
is not valid because which thing on the left do you change: x, x2, or both?
This means that the following is a perfectly reasonable thing to write;
x=x+1;
As an equation this makes no sense, but as an instruction it makes perfect sense, its "make x equal to what x is now plus 1"
###Other issues
After solving this you will also find that distanceTo() is defined as returning a double but doesn't, you need to return some "answer" or change its return to void
In Java (and most programming languages) you should not consider yourself to be writing equations but instructions:
= basically means make the left "thing" what the right "thing" currently is, or in the words of StormeHawke
the = operator in Java and most other programming languages should not mentally be read as "equals" but rather "is defined as"
so
x3= x - x2;
is valid because you can change x3 to be x - x2, but
x - x2 = x3;
is not valid because which thing on the left do you change: x, x2, or both?
This means that the following is a perfectly reasonable thing to write;
x=x+1;
As an equation this makes no sense, but as an instruction it makes perfect sense, its "make x equal to what x is now plus 1"
###Other issues
- After solving this you will also find that
distanceTo()is defined as returning a double but doesn't, you need to return some "answer" or change its return to void - x3 is also not defined as "being" anything, it needs to be declared before/when its used, presumable as a double
In Java (and most programming languages) you should not consider yourself to be writing equations but instructions:
= basically means make the left "thing" what the right "thing" currently is, or in the words of StormeHawke
the = operator in Java and most other programming languages should not mentally be read as "equals" but rather "is defined as"
so
x3= x - x2;
is valid because you can change x3 to be x - x2, but
x - x2 = x3;
is not valid because which thing on the left do you change: x, x2, or both?
This means that the following is a perfectly reasonable thing to write;
x=x+1;
As an equation this makes no sense, but as an instruction it makes perfect sense, its "make x equal to what x is now plus 1"
But
x - x2 = x3;
can't be expressed###Other issues
After solving this you will also find that distanceTo() is defined as an instruction, should x be changed, or x2returning a double but doesn't, you need to return some "answer" or both?change its return to void
In Java (and most programming languages) you should not consider yourself to be writing equations but instructions:
= basically means make the left "thing" what the right "thing" currently is, or in the words of StormeHawke
the = operator in Java and most other programming languages should not mentally be read as "equals" but rather "is defined as"
so
x3= x - x2;
is valid
x - x2 = x3;
is not
This means that the following is a perfectly reasonable thing to write;
x=x+1;
As an equation this makes no sense, but as an instruction it makes perfect sense, its "make x equal to what x is now plus 1"
But
x - x2 = x3;
can't be expressed as an instruction, should x be changed, or x2, or both?
In Java (and most programming languages) you should not consider yourself to be writing equations but instructions:
= basically means make the left "thing" what the right "thing" currently is, or in the words of StormeHawke
the = operator in Java and most other programming languages should not mentally be read as "equals" but rather "is defined as"
so
x3= x - x2;
is valid because you can change x3 to be x - x2, but
x - x2 = x3;
is not valid because which thing on the left do you change: x, x2, or both?
This means that the following is a perfectly reasonable thing to write;
x=x+1;
As an equation this makes no sense, but as an instruction it makes perfect sense, its "make x equal to what x is now plus 1"
###Other issues
After solving this you will also find that distanceTo() is defined as returning a double but doesn't, you need to return some "answer" or change its return to void