Thanks for all your help. Somethings in my mind though: In c++ you can pass pointers and refferences into a funtion. So in java is there any simple way to do this? I searched the forums and found "event methods", wow I don't want to get into that. Therefore, this can't be done as it can in c++ can it (create a refference to an object)?
Here's a little example I Found.
#include <iostream>
#include <stdlib.h>
void swap(int &x, int &y);
int main()
{
int x = 5, y = 10;
std::cout << "Main. Before swap, x: " << x
<< " y: " << y << "\n";
swap(x,y);
std::cout << "Main. After swap, x: " << x
<< " y: " << y << "\n \n \n";
int x2 = 30, y2 = 40;
std::cout << "Main. Before swap, x: " << x2
<< " y: " << y2 << "\n";
swap(x2,y2);
std::cout << "Main. After swap, x: " << x2
<< " y: " << y2 << "\n";
system("Pause");
return 0;
}
void swap (int &rx, int &ry)
{
int temp;
std::cout << "Swap. Before swap, rx: " << rx
<< " ry: " << ry << "\n";
temp = rx;
rx = ry;
ry = temp;
std::cout << "Swap. After swap, rx: " << rx
<< " ry: " << ry << "\n";
}
Quote:
|
Source: "Sam's teach yourself c++" by Jesse Liberty
|
And if the answer is "No java can't do that", wow i'm in a state of shock.
Now back to finishing this tetris game.