Skip to main content



      Home
Home » Newcomers » Newcomers » Wildcard import vs static import(Using wildcard imports seems to behave differently than static imports)
Wildcard import vs static import [message #1691329] Mon, 06 April 2015 01:48 Go to next message
Eclipse UserFriend
Hi all,

I am really new to Eclipse and Java in general, but I encountered the following behaviour and don't know how to explain / fix it properly:

With this small piece of code:

import java.util.*;

public class testClass {

	public static void main(String[] args) {
		List<String> list = new ArrayList<String>();
	}

}


I get the following Eclipse error:

The type ArrayList is not generic; it cannot be parameterized with arguments <String>

If I change the import on the top to be:

import java.util.List;
import java.util.ArrayList;


So why isn't this piece of code valid with wildcard import?
Re: Wildcard import vs static import [message #1691346 is a reply to message #1691329] Mon, 06 April 2015 08:27 Go to previous message
Eclipse UserFriend
I actually figured this out already. Had accidentally left an override of ArrayList in the project thus the normal import did not work properly. Removed override -> Everything worked as should Smile
Previous Topic:eclipse hyperlink not working
Next Topic:Developing a JAVA FX GUI with Eclipse
Goto Forum:
  


Current Time: Fri May 16 07:17:28 EDT 2025

Powered by FUDForum. Page generated in 3.74782 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top