Hi
I have 2 classes as follows:
public class A
{
String sv[] = new String[1000];
// Add values into sv.............
.........................
.........................
.........................
B k = new B(); // Call Class B
B.cards_output(sv); // invoke a method in Class B
} // End of Class A
public class B
{
// general declaration
public String copy_sv[] = new String[1000];
......
......
......
......
public void cards_output(String sv[]) // function in class B
{
for(int i=0;i<sv.length();i++)
{
copy_sv=sv;
}
}
} // End of Class B
I can only use copy_sv[] only in the functions that i pass that value to, I need copy_sv[] to be accessible everywhere in the program.
Now when ever I try to make a reference to copy_sv[] elsewhere in the program I am getting a Null pointer exception.
I tried using cloneable interface with clone method but again got a null pointer exception.