|
How do I pass objects to a method in another class so that when I manipulate the values in the method the original object isn't modified? My example code would be far too long to post but it's basically something like: ObjectA A = new ObjectA(blah, blah blah); ObjectB B = new ObjectB(); int crazyCalculations = B.doSomeCalculationsWithA(A); Is there a quick way to make it so the original A won't be changed by B's method? Hopefully some sort of way that won't make me rewrite all my methods completely but simply just kinda add a keyword or something..
|
# ¿ Mar 25, 2008 02:43 |
|
|
# ¿ May 6, 2024 17:24 |
|
I'm typing 'objectsName.' in my IDE (eclipse) and when the list of methods comes up none of them are clone(). The object is a class I defined myself, would I need it to implement something for .clone() to work? Or alter my class in someway?
|
# ¿ Mar 25, 2008 02:59 |
|
I like this constructor idea, it seems to be the neatest codewise and would require the least amount of revision of my broken code. In the constructor how would I go about creating a copy if everything is passed by reference still? Is it more complicated if my class serves as a ArrayList container for sub classes?
|
# ¿ Mar 25, 2008 03:57 |
|
Hello CoC, I was wondering how to run a desktop swing application without having the ugly console window staying in the background. I'm currently using a batch script which simply calls "java myMainClass" and the console window seems to just get stuck there until my GUI is closed. Is there a better way to do this? Edit: I'm using Windows if that makes a difference. I've also tried making a c++ executable which tries to start my java program through WinExec() but the problem still arises. FearIt fucked around with this message at 02:53 on May 14, 2009 |
# ¿ May 14, 2009 02:50 |
|
OddObserver posted:javaw myMainClass if my memory serves me right. Jackpot, thank you OddObs
|
# ¿ May 14, 2009 03:18 |
|
|
# ¿ May 6, 2024 17:24 |
|
Hello again CoC, I'm trying to add a right click JPopupMenu to a JTextArea so that I may easily copy, cut and paste. I've tried googling for examples but I haven't found any good ones that really fit what I'm trying to do. Any help would be great. Thanks CoC.
|
# ¿ May 27, 2009 04:04 |