|
Post by CooLiBoP on Feb 14, 2002 19:21:20 GMT -5
When we create a new object are the constructor methods included? They are methods after all...
e.g. (Object Space memory box)
0000 A int a 5 blahMethod(int number) A() // Should this be included? A(String sa) // What about this? String toString()
EDIT : Sorry didn't mean to have a main(String[] args)...
|
|
bAh
Junior Member
Posts: 23
|
Post by bAh on Feb 14, 2002 20:56:34 GMT -5
When we create a new object are the constructor methods included? They are methods after all... e.g. (Object Space memory box) 0000 A main(String[] args) int a 5 blahMethod(int number) A() // Should this be included? A(String sa) // What about this? String toString() hmm..... the memory box u created is a main method.... isn't it supposed to be in stack instead of object space? or probably i'm just plain stupid and misunderstood ur question...
|
|
bAh
Junior Member
Posts: 23
|
Post by bAh on Feb 14, 2002 20:58:55 GMT -5
and then.... with the main in stack... the all non-static methods u have inside should be shifted to object space..... static vars and string[] args goes to static space... etc.....
ack.... csc148 took the fun out of computers... after friday i'm soooo gonna spend the entire day playing Ghost Recon and CS... my stress has to go somewhere... u know!
|
|
|
Post by Observer on Feb 14, 2002 23:04:25 GMT -5
I think the instance methods are supposed to be in it (the static methods are taken care of in the static space). I'm finding that memory model diagrams/labelling are inconsistent from one to the next, even those sometimes done by the same lecturer.
|
|
|
Post by CooLiBoP on Feb 14, 2002 23:33:39 GMT -5
I think the instance methods are supposed to be in it (the static methods are taken care of in the static space). I'm finding that memory model diagrams/labelling are inconsistent from one to the next, even those sometimes done by the same lecturer. Are constructors static? I don't think they are...If so are they supposed to be in the static area of the heap?
|
|
|
Post by Observer on Feb 15, 2002 0:04:32 GMT -5
Constructor's aren't static. So they probably should go in the instance boxes. I've never really seen them drawn in one though. If asked I'll probably just write the instance methods/variables and ignore the constructor.
A question: Can anyone direct me to a link where I could find a fully implemented iterator? It's probably a bit late to be asking this now but I was hoping that they'd put solutions up to other tutorials or assignments but they're so lazy.
Modifying to say: nevermind about that, got one from the winter 2001 test from the website.
|
|