Java notes
Jan. 14th, 2009 04:56 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
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
Date: 2009-01-15 01:22 am (UTC)no subject
Date: 2009-01-15 02:19 am (UTC)Also, MySQL counts from 1 when doing str positioning and what-not. >_>