troubleshooting Question

How is this variable (vec) suddenly not being seen? (NPE). The code has not been altered since the calls last functioned properly.

Avatar of krakatoa
krakatoaFlag for United Kingdom of Great Britain and Northern Ireland asked on
Java
21 Comments1 Solution113 ViewsLast Modified:
vec = new Vector<String>(fArr.length); // Vector<String> vec declared earlier.
    
                        
            for(File fi : fArr){vec.add(fi.getName());}
            
            for(Object s : vec.toArray()){System.out.println((String)s);} // this prints the filenames to the console
            
            System.out.println("Files length is  "+fArr.length);// prints whatever length the array is
            System.out.print("vec is "); 
            System.out.println(vec==null); // prints TRUE !!
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 21 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 21 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros