Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
What is the size of s.size ? What is the Error ? How to Solve it ?
Atul Bhartia
Greenhorn
Posts: 4
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
import java.util.HashSet; import java.util.Set; public class CharPair{ private char first; private char second; public CharPair(char first,char second){ this.first=first; this.second=second; } public boolean equals(CharPair o){ return ((o.first==first) && (o.second==second)); } public static void main(String [] args){ Set< CharPair > s = new HashSet< CharPair > (); for(int i=0 ; i<10 ; i++){ for(char ch='a' ; ch<='z' ; ch++){ s.add(new CharPair(ch,ch)); } } System.out.println(s.size()); } }
Stuart A. Burkett
Ranch Hand
Posts: 679
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What makes you think there is an error ?
If the code is not compiling you need to tell us what the errors are.
If the code is not running as expected, then you need to tell us what it is doing and how this differs from what you expected.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
IllegalMonitorStateException
Prompt for file name
function Numeric_data
JTables editor/renderer ?
Java File Operation
More...