Hi guys,
I am relatively new to java language of which I'm studying at the moment. I Have spent considerable time looking through examples and java class libraries but have not been successful in finding a solution for:
1) naming an Array within a method
2) adding data to the Array of the given name
3) When intialising an array do i need to define a type such String or int e.g. "ArrayList<String> playListName"?
4) If the array is of String type can you later add other types such as int? or is it best to leave as String type and convert other types to String such as if you have a int value as 2011 you would "Integer.toString"
My code thus far
// imports
import java.util.ArrayList;
import java.util.*;
public class Playlist
{
// Instance variables
//public String[] playListName;
public String playListName = "";
/**
* Creates a name for the Playlist (type as String)
*/
public void newPlayListName(String newPlayListName)
{
playListName = newPlayListName;
System.out.println("Current Playlist is " + "{" + newPlayListName + "}");
ArrayList<String> playListName;
}
/**
* Stores Track Reference name
*/
public void storeTrack(String referenceNumber)
{
//
playListName.add(referenceNumber);
}
}
Thanks in advance :)
monolithcode