0

--------------------Configuration: <Default>--------------------
C:\Documents and Settings\mykel\Desktop\auto.java:4: unexpected type
found : char
required: reference
Set <char>setAlpha = new HashSet<char>();
^
C:\Documents and Settings\mykel\Desktop\auto.java:4: unexpected type
found : char
required: reference
Set <char>setAlpha = new HashSet<char>();
^
2 errors

how come i cant cast a char on a set??? it works well with other data types.

thanks in advance

2
Contributors
5
Replies
7
Views
10 Years
Discussion Span
Last Post by jwenting
0

char is a primitive, you can't store primitives in Collections.
Make it Set<Char> instead, and autoboxing will ensure your chars are converted into Chars and back again.

0

thanks Jwenting.

i have been waiting for a reply. hehehe

were on a tight deadline for our seniors thesis project

0

--------------------Configuration: <Default>--------------------
C:\Documents and Settings\mykel\Desktop\auto.java:4: cannot find symbol
symbol : class Char
location: class auto
Set <Char>s = new HashSet<Char>();
^
C:\Documents and Settings\mykel\Desktop\auto.java:4: cannot find symbol
symbol : class Char
location: class auto
Set <Char>s = new HashSet<Char>();
^
2 errors

whats autoboxing???

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.