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 3 of 3

Thread: help please. even simple programs are not running in any IDE

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

    Default help please. even simple programs are not running in any IDE

    I've been trying the following code for a while but in vain. I've tried simple text editors and even various IDEs. Please tell me what's wrong with this:

    import java.util.Random;
    class PlayTwentyOne {//even adding "public" before makes no difference
    public static void main(String args[]) {
    Random myRandom = new Random();
    int card, total = 0;
    System.out.println(“Card Total”);
    while (total < 21) {
    card = myRandom.nextInt(10) + 1;
    total += card;
    System.out.print(card);
    System.out.print(“ “);
    System.out.println(total);
    }
    if (total == 21) {
    System.out.println(“You win :-)”);
    } else {
    System.out.println(“You lose :-(“);
    }
    }
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: help please. even simple programs are not running in any IDE

    Please explain what you have done and what happens. Post the full text of any error messages.

    Please Edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: help please. even simple programs are not running in any IDE

    @Norm: Well I solved the problem. The error arose due to mismatch in text formats.
    When I deleted the quotation marks and entered them again. it ran perfectly.
    Sorry for the inconvenience. Thanks.
    P.S.: Will be seeking more help in future as it's just the beginning.

Similar Threads

  1. Using i-1 in programs
    By JoshKesner in forum Java Theory & Questions
    Replies: 4
    Last Post: November 7th, 2012, 05:01 PM
  2. Please help me write two very simple programs
    By ibex333 in forum Java Theory & Questions
    Replies: 1
    Last Post: March 11th, 2012, 05:41 PM
  3. need help make a programs...
    By grendar in forum Loops & Control Statements
    Replies: 3
    Last Post: April 13th, 2011, 01:02 PM
  4. Replies: 0
    Last Post: December 12th, 2009, 09:09 PM