Results 1 to 3 of 3
  1. #1
    yasmin k is offline Member
    Join Date
    Mar 2009
    Posts
    23
    Rep Power
    0

    Exclamation help! problem with eclipse?

    hello

    i have created a simple hash set where it takes two simple argument and will give me 3 output, intersection, union and minus. It seem to me that i did everything right (i guess not), no error seem to show by using eclipse. i give 2 argument (string) but once i proceed it says "it could not find the main class." here is my program below. how do i fix this problem?

    thanks ;)
    Java Code:
    import java.util.HashSet;
    class hashSet
    {
    
    	   static HashSet <Character> stringToSet(String s)
    	{
    		HashSet <Character> s1= new HashSet();
    		for (int i=0;i<s.length();i++)
    		{
    			s1.add(s.charAt(i));
    			
    		//converts a set of string into a set. 
    		} 
    		return s1;
    	
    	}
    
    	public static void main(String [] args)
    	{
    		HashSet <Character> a1 = stringToSet(args[0]);
    		HashSet <Character> a2 = stringToSet(args[1]);
    		
    		
    		
    		
    		HashSet b = sets.union(a1, a2);
    		HashSet c = sets.intersection(a1, a2);
    		HashSet d = sets.minus(a1, a2);
    System.out.println(b);System.out.println(c);System.out.println(d);
    	}
    }
    Last edited by yasmin k; 04-17-2010 at 07:45 PM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    You are using the variable "sets", but where do you declare it and where do you initialize it? Also, please note that this question has absolutely nothing to do with Eclipse.

    Best of luck!

  3. #3
    yasmin k is offline Member
    Join Date
    Mar 2009
    Posts
    23
    Rep Power
    0

    Default

    oh i see!! silly me!! i need to create another class to define sets.

    Thank you!

Similar Threads

  1. Eclipse problem
    By SwEeTAcTioN in forum New To Java
    Replies: 2
    Last Post: 12-27-2009, 09:52 AM
  2. JPA problem in Eclipse
    By tascoa in forum New To Java
    Replies: 0
    Last Post: 11-25-2009, 02:38 PM
  3. Problem with Eclipse
    By lobodelbosque in forum New To Java
    Replies: 3
    Last Post: 11-24-2009, 09:49 PM
  4. having problem with eclipse
    By sengupta_piyal06 in forum Eclipse
    Replies: 1
    Last Post: 11-21-2008, 06:29 PM
  5. Eclipse AST problem
    By java_neophyte in forum Eclipse
    Replies: 0
    Last Post: 10-04-2008, 12:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •