nemorathwald (
nemorathwald) wrote2009-01-14 04:56 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Java notes
Halfway break in Java class.
Everyone was surprised that I was never taught in second grade "Please Excuse My Dear Aunt Sally". First you resolve parentheses and exponents, second you resolve multiplication and division operators, third you resolve addition and subtraction operators. However, Java doesn't have the exponent operator and it does have a remainder operator, so I decided it's "Prosecute My Dirty Rotten Aunt Sally".
It's counter-intuitive for me to do integer arithmetic, in which every step, Java gets rid of the fraction. 7/2=3
It takes me a long time to perform basic arithmetic in my head, on the best of days.
String fullname;
fullname = "John Kennedy"
secondLetter = fullname.charAt(1);
It returns 'o' not 'J' because everything counts from 0. Zero is always the first number. 1 is the second number.
age = age -3; // same as age -= 3;
Today's flashcard:
In an expression, what is the difference between variable++ and ++variable?
With x++ Java waits to resolve the rest of the expression before incrementing x by 1.
Everyone was surprised that I was never taught in second grade "Please Excuse My Dear Aunt Sally". First you resolve parentheses and exponents, second you resolve multiplication and division operators, third you resolve addition and subtraction operators. However, Java doesn't have the exponent operator and it does have a remainder operator, so I decided it's "Prosecute My Dirty Rotten Aunt Sally".
It's counter-intuitive for me to do integer arithmetic, in which every step, Java gets rid of the fraction. 7/2=3
It takes me a long time to perform basic arithmetic in my head, on the best of days.
String fullname;
fullname = "John Kennedy"
secondLetter = fullname.charAt(1);
It returns 'o' not 'J' because everything counts from 0. Zero is always the first number. 1 is the second number.
age = age -3; // same as age -= 3;
Today's flashcard:
In an expression, what is the difference between variable++ and ++variable?
With x++ Java waits to resolve the rest of the expression before incrementing x by 1.
no subject
But that's getting less common these days with the rise of the so called "curly bracket languages" that tend to build on BCPL conventions for counting as well as syntax.