Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on 

NetBeans... why arguments are not read from the configuration screen

A practice Vector object is not reading arguments from NetBeans. I am including both the code and configuration screen below.

Question: Could you add some comments as to how this code works, after you possibly tell me why four names (arguments) are not read from the configuration screen?

Thank you.
import java.util.*;

public class StringLister {
    String[] names = { "spanky", "alfalfa", "Buckwheat", "Daria", 
            "stymie", "Marianne", "Scotty", "Tommy", "Chubby" };
            
    public StringLister(String[] moreNames) {
        Vector <String> list = new Vector<String>();
        for(int i=0; i< names.length; i++) {
            list.add(names[i]);
        }
        for (int i = 0; i < moreNames.length; i++) {
            list.add(moreNames[i]);
    }
        Collections.sort(list);
        for (String name : list) {
            System.out.println(name);
        }
    }
    
    public static void main(String[] args) {
      StringLister lister= new StringLister(args);  
    }
}

Open in new window

ConfiScreen.png
Java

Avatar of undefined
Last Comment
Mike Eghtebas
Avatar of zacheusz
zacheusz
Flag of Poland image

you have to right-click on project and select Run
when you click on java file NB don't use run configuration
ASKER CERTIFIED SOLUTION
Avatar of zacheusz
zacheusz
Flag of Poland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

ASKER

I was expecting 9 plus 4 more from the argument list:

1. Alfalfa
2. Buckwheat
3. Chubby
4. Daria
5. Farina
6. Jackie
7. Marianne
8. Mivkey
9. Scotty
10. Spanky
11. Stymie
12. Tommy
13. Woim

You direction helped me to solve it.

Thank you,

Mike
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo