Results 1 to 2 of 2

Thread: Array

  1. #1
    phantom06 is offline Member
    Join Date
    Nov 2010
    Rep Power

    Default Array

    public CD2(String title, String singer, double price, String category, String discount, String [] track,
    String[]time,int numSong)

    CD2 C = new CD2(arr[0], arr[1], Double.parseDouble(arr[2]), arr[3], arr[4],

    Like in the code above, where i use Double.parseDouble(arr[2]) to change it to double, how to change the arr[5] to array?

  2. #2
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Rep Power


    Array of what? string, character?
    You can use split() or toCharArray() method;
    Java Code:
    String[] arr2 = arr[5].split(",");
    char[] arrChar = arr[5].toCharArray();

Similar Threads

  1. Replies: 23
    Last Post: 09-07-2010, 08:12 PM
  2. Replies: 2
    Last Post: 09-06-2010, 01:03 AM
  3. create a 2d char array from a 1D string array
    By jschmall12 in forum New To Java
    Replies: 1
    Last Post: 04-27-2010, 09:01 PM
  4. Array length and printing out uninitialized array.
    By nicolek808 in forum New To Java
    Replies: 4
    Last Post: 09-10-2009, 09:12 AM
  5. Replies: 1
    Last Post: 03-31-2009, 06:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts