Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Code for EvenCount

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Code for EvenCount

     package mocktest;
     
    public class EvenCount {
     
        public String count(String x) {
     
    	if (x < 10 && x % 2 == 0)
    	    return 1; 
    	else if (x < 10 && % 2 !0)
    	    return 0;
    	else if ((x >=10 && (x / 10 ) % 2 == 0)
    	    return 1 + count(x/10) + 1;
    		 else
    		     return count (x/10);
        }
        public static void main (String args[]); {
     
    	EvenCount c = new EvenCount ();
    	System.out.println(x.count(73221));
        }
    }

    Why do i have so many errors?


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: Code for EvenCount

    Please don't double post your question as that's not fair to the folks who help here. I suggest that you decide on closing one of the duplicates. Same for your other questions on this forum.

Similar Threads

  1. How to Translate working code into code with a Tester Class
    By bankoscarpa in forum What's Wrong With My Code?
    Replies: 6
    Last Post: October 15th, 2012, 02:13 PM
  2. Code for EvenCount
    By Mehwish-S in forum What's Wrong With My Code?
    Replies: 8
    Last Post: August 22nd, 2012, 09:02 AM
  3. code to refresh and check the code of a webpage..
    By vaggelis in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 7th, 2012, 07:43 AM
  4. problem in my code java code graph editeur
    By kisokiso in forum Java Theory & Questions
    Replies: 5
    Last Post: January 6th, 2012, 08:36 AM
  5. Code is giving an error in console, but there are no errors apparent in the code!
    By JamEngulfer221 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 15th, 2011, 09:30 PM