Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

easy java problem help

Name: Anonymous !8Z96F5duBs 2008-12-21 1:32

hey /prog/ im having a problem in java.

So im reading this text book, and it asks " Write a single line of code that uses the compound operator, -=, to subtract p-30 from the integer value v and store the result back in v. "

now im trying to use:

int v -= p-30;

but its not working in java, what could i be doing wrong?

Name: Anonymous 2008-12-21 1:34

tripcode
trivial problem
no apostrophes
DON'T HELP HIM!

Name: Anonymous !8Z96F5duBs 2008-12-21 1:34

btw i just started a night ago, so dont shit your pants at my wrong answer

Name: Anonymous 2008-12-21 1:34

v-=p-30 is v = v - p - 30

the compiler reads from left to right if the operators are on same precedence

try v-=(p-30)

Name: Anonymous 2008-12-21 1:35

Maybe it works in Scheme.

Name: Anonymous !8Z96F5duBs 2008-12-21 1:39

>>4

yeah its still having errors


instead i went ahead and did:

int v, p;
v -= (p-30);


but its still having problems compiling it, even w\o parens

maybe im over thinking it, so im just wondering wtf

Name: Anonymous 2008-12-21 1:44

OMG

Name: Anonymous 2008-12-21 1:45

>>5
doesnt everything?

Name: Anonymous 2008-12-21 1:45

the problem is v needs a value before you can modify it with a compound operator. You can't subtract from a NULL value.

Name: Anonymous 2008-12-21 1:46

same with p too, give it a starting value.

Name: Anonymous 2008-12-21 1:46

ah, i figured it out, i had to assign v and p values or else it wouldnt compile


im dumb T_T

Name: Anonymous 2008-12-21 1:47

can you add to NULL?

Name: Anonymous 2008-12-21 1:56

can you add to FAGGOT?

Name: Anonymous 2008-12-21 1:58

your dumb

Name: Anonymous 2008-12-21 2:10

>>13
can you add to MY DICK?

Name: Anonymous 2008-12-21 2:39

his dumb

Name: Anonymous 2008-12-21 3:22

you didn't define a value for v

try doing int v = 0;
and then, v -= p - 30

Name: Anonymous 2008-12-21 3:44

(defn -= [v p](- v p 30))

Name: Anonymous 2008-12-21 11:42

>>17
>>17
>>17
>>17
>>17
Now depart from this place IMMEDIATELY

Name: Anonymous 2008-12-21 21:19

>>15
I WOULD BUT I CAN'T FIND IT, PLEASE REMOVE IT FROM THAT FAGGOTS ASS!

Name: Anonymous 2009-03-06 6:37


Control if you posted   But even then   you could write   some nasty ass   shit that uses   the compound operator.

Name: Trollbot9000 2009-07-01 7:57


Then the bastard beside.

Name: Anonymous 2010-11-26 20:51

Don't change these.
Name: Email:
Entire Thread Thread List