Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 05:48 Go to next message
Tomi Reunanen is currently offline Tomi ReunanenFriend
Messages: 2
Registered: April 2015
Junior Member
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 12:27 Go to previous message
Tomi Reunanen is currently offline Tomi ReunanenFriend
Messages: 2
Registered: April 2015
Junior Member
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: Thu Mar 28 22:21:36 GMT 2024

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

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

Back to the top