• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What are Wildcards?

 
Umesh Kilkile
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Explain me simple words or
Please suggest me any good site,where I can learn Wildcards.

Thank You,

Umesh K
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a wildcard represents something unknown or undefined.
As a basic example we use '?' to represent a single character and '*' to represents zero or more characters
So test?.txt matches test1.txt testA.txt but not test.txt or testAB.txt
test*.txt matches everything test?.txt matches and a bunch more.

Learn by doing. Regular Expressions are all about matching patterns and make extensive use of wildcards.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whihch wildcards? You get wildcards (as David O'M has already told you) in regular expressions, and also in actual type parameters for generics. Probably elsewhere too.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but in a general sense both represent "something unknown or undefined"
eg List<T> is a "List of something"
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
eg List<T> is a "List of something"

Just to clarify, I don't think this is an example of wildcard. T in this case is a type parameter. Wildcard would be the question mark in List<?>.
 
Umesh Kilkile
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Actually I wanted to learn using wildcards in Java and in Generics.

Please help me.

Thank You,

Umesh
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this one. It is the Sun's (now Oracle's) own tutorial.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic