Results 1 to 2 of 2
  1. #1
    MartyP is offline Member
    Join Date
    Mar 2011
    Posts
    10
    Rep Power
    0

    Default 'Inline' type declaration

    Dear all, I have some code similar to this:
    Java Code:
    int[] something = {1,2,3}; 
    vector.add(something);
    And it's done about ten times with different array. But this feels very awkward, is there any way to do something like
    XML Code:
    vector.add({1,2,3});
    or
    XML Code:
    vector.add(int[] {1,2,3});
    Like with string and integers?

    Greetings,
    Marty

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    the second one (if you use new int[] rather than just int[]) works.

Similar Threads

  1. JavaBean - invalid method declaration and return type required
    By jprog in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 05-07-2011, 06:13 PM
  2. invalid method declaration; return type required
    By XaviannNJ in forum JCreator
    Replies: 7
    Last Post: 11-25-2010, 01:59 PM
  3. Replies: 1
    Last Post: 10-08-2010, 05:30 AM
  4. Inline JVM assembly in Java
    By youngstorm in forum Advanced Java
    Replies: 2
    Last Post: 09-15-2010, 07:14 PM
  5. Replies: 3
    Last Post: 06-05-2010, 08:05 PM

Posting Permissions

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