Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2009
    Posts
    26
    Rep Power
    0

    Default help with java coding

    This is my second coding in java...

    I have problems with the joptionpane line.... I copied it exactly from the book like this:


    Java Code:
    //This is my class (container) name
    
    public class EG02
    {
        //main method (function)
        public static void main(String[] args)
        {
            String input;
            input = JOptionPane.showInputDialog ("What's your name?");
            if(input.equals("FUCK YOU BITCH"))
            {
                System.out.println("Congratulations!");
            } else
            {
                System.out.println("Sorry, you lose!");
            }
        }
    }

  2. #2
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    7

    Default

    copied it exactly eh lol? What book are you using?

    You need to import javax.Swing.JOptionPane;
    Liberty has never come from the government.
    Liberty has always come from the subjects of government.
    The history of liberty is the history of resistance.
    The history of liberty is a history of the limitation of governmental power, not the increase of it.

  3. #3
    Join Date
    Nov 2009
    Posts
    26
    Rep Power
    0

    Default

    wow, your a genius. I didn't copy it directly. I thought I did...

    Thanks.



    Book is Programming Video Games for the Evil Genius by Ian cinnamon

  4. #4
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    7

    Default

    No worries. I was laughing about the expected name to be input, but judging by the title that might actually be in the book.
    Liberty has never come from the government.
    Liberty has always come from the subjects of government.
    The history of liberty is the history of resistance.
    The history of liberty is a history of the limitation of governmental power, not the increase of it.

  5. #5
    aaroncarpet's Avatar
    aaroncarpet is offline Senior Member
    Join Date
    Nov 2009
    Location
    California
    Posts
    147
    Rep Power
    0

    Default

    i thought it was funny
    Last edited by aaroncarpet; 11-14-2009 at 04:04 PM. Reason: it wont compile needs a parent container the code i put up

Similar Threads

  1. java coding
    By zawad in forum Suggestions & Feedback
    Replies: 1
    Last Post: 07-07-2009, 02:55 PM
  2. Java coding Best Practices
    By ajeeb in forum Advanced Java
    Replies: 6
    Last Post: 05-27-2009, 05:30 AM
  3. Coding an FTP server in java
    By Zucheto in forum Networking
    Replies: 3
    Last Post: 06-22-2008, 05:24 AM
  4. Java Coding Competition
    By nbrain in forum Java Software
    Replies: 0
    Last Post: 05-22-2008, 06:38 PM
  5. Coding Java on a Mac
    By Menre in forum New To Java
    Replies: 5
    Last Post: 05-06-2008, 06:49 AM

Posting Permissions

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