Results 1 to 5 of 5
  1. #1
    farahm is offline Member
    Join Date
    Nov 2010
    Location
    Beirut, Lebanon
    Posts
    36
    Rep Power
    0

    Default small problem, thanks in advance for your help

    so this part of my code doesnt seem to compile:
    if ((len < 6) || (len > 15))
    {
    System.out.println("rule1 violated");
    }
    else
    {
    int charCount = 0;
    int intCount = 0;
    for(int i = 0; i < len; i++)
    {
    charCount = ((i > 65 && i < 90) || (i > 97 && i < 122));
    charCount++;
    intCount = (i > 48 && i < 57);
    intCount ++;
    }
    }
    im writing a password check program and one of the rules is to have at least a letter and at least a number but for charCount = ((i>65.....)) it says :incompatible types found boolean but expected int
    any suggestions?

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    841
    Rep Power
    6

    Default

    charCount is an integer variable which has return type of boolean.Thats why u got the error.

    First learn the basics in sun site ,then you start working on code.
    Ramya:cool:

  3. #3
    farahm is offline Member
    Join Date
    Nov 2010
    Location
    Beirut, Lebanon
    Posts
    36
    Rep Power
    0

    Default

    i sorted out my problem.
    thank you

  4. #4
    farahm is offline Member
    Join Date
    Nov 2010
    Location
    Beirut, Lebanon
    Posts
    36
    Rep Power
    0

    Default

    i used the isLetter and isDigit instead

  5. #5
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    Quote Originally Posted by farahm View Post
    i used the isLetter and isDigit instead

    Yes, they're much better.

Similar Threads

  1. How to advance ?
    By House in forum New To Java
    Replies: 14
    Last Post: 08-29-2010, 03:29 AM
  2. small problem
    By rawan in forum Java Applets
    Replies: 2
    Last Post: 04-07-2010, 03:32 AM
  3. Advice for Advance projects?
    By suyash89 in forum Advanced Java
    Replies: 7
    Last Post: 01-02-2010, 10:51 PM
  4. small problem
    By barusk in forum Networking
    Replies: 4
    Last Post: 03-21-2009, 06:19 AM
  5. Small problem
    By ayoood in forum New To Java
    Replies: 2
    Last Post: 06-06-2008, 12:27 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
  •