Reusing String Arrays
I am trying to reuse an array where eventually I am going to put AIX commands but I get compile errors when I try to reuse it. I am a newborn to Java. I don't want to enter the elements on an item by item basis and would rather not create a seperate array.
Excerpt
// Create an Initial version of Command Array
String[] command = { "a", "b", "c"};
// Now try to reuse it to store new values. This is wrong
command = {"d", "e", "f"};
Full Code is below..
import java.io.*;
import java.net.*;
import java.util.*;
import java.text.*;
public class arrays
{
public static void main(String[] args)
{
try{
// Create an Initial version of Command Array
String[] command = { "a", "b", "c"};
// Now try to reuse it to store new values. This is wrong
command = {"d", "e", "f"};
}
catch( Exception e )
{ e.printStackTrace(); }
}
}
Upon Trying to compile this I get the following Error Message:
arrays.java:18: illegal start of expression
command = {"d", "e", "f"};
^
|