5 Replies - 189 Views - Last Post: 16 January 2013 - 11:00 PM Rate Topic: -----

#1 varld  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-January 13

Needing some assistance on a problem, unique characters

Posted 16 January 2013 - 04:43 PM

public class AllUniqueStrings1 {

	public static boolean allUniqueChars(String s) {
	   boolean[] char_set = new boolean[256];
	    for (int i = 0; i < s.length(); i++) {
	        int val = s.charAt(i);
	        if (char_set[val])
	            return false;
	        char_set[val] = true;
	    }
	    return true;
	}
}



It compiles but it does not run properly. needing some assistance.

Is This A Good Question/Topic? 0
  • +

Replies To: Needing some assistance on a problem, unique characters

#2 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: Needing some assistance on a problem, unique characters

Posted 16 January 2013 - 04:50 PM

Welcome to DIC, good job figuring out code tags.

Another simple thing we ask is to post any errors you're getting and to be more descriptive about the type of help you need. "It does not run properly," is not very helpful. Describe what is or isn't proper, what it is doing that it shouldn't, and/or what it isn't doing that it should.
Was This Post Helpful? 0
  • +
  • -

#3 varld  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-January 13

Re: Needing some assistance on a problem, unique characters

Posted 16 January 2013 - 04:53 PM

Exception in thread "main" java.lang.NoSuchMethodError: main
Was This Post Helpful? 0
  • +
  • -

#4 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: Needing some assistance on a problem, unique characters

Posted 16 January 2013 - 04:57 PM

The entry point for all Java classes that are to be run as stand-alone programs is a static main() method. The signature of the main() method has to be (nearly) exactly:
public static void main( String[] args )
{
    // code to be executed to start the
    // program goes here

}

The error message is telling you that your program, or the AllUniqueStrings1 class, is missing a main() method, the required starting point.
Was This Post Helpful? 0
  • +
  • -

#5 varld  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-January 13

Re: Needing some assistance on a problem, unique characters

Posted 16 January 2013 - 05:24 PM

can someone please delete this thread.
Was This Post Helpful? 0
  • +
  • -

#6 natecat  Icon User is offline

  • D.I.C Head

Reputation: 53
  • View blog
  • Posts: 225
  • Joined: 19-December 11

Re: Needing some assistance on a problem, unique characters

Posted 16 January 2013 - 11:00 PM

This is a public forum, all questions that follow the rules are kept so people who google similar problems can find one of these threads and save time.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1