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

Thread: whats wrong

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default whats wrong

    public class main
    {
    public static void main(String [] args)
    {
    lyric a = new lyric();
    String[] b = new String[52];
    b = lyric.populatearrayldb;

    for (int i = 0; i < 52; i++){

    System.out.println("");
    } try
    {
    Thread.sleep(500);

    }
    catch(InterruptedException n)
    {}
    }
    }



    in line 7 my error is cannot find symbol variable populatearrayldb


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: whats wrong

    First off, you need to fix your indentation and naming conventions (classes start with an uppercase letter). You also shouldn't have empty catch blocks.

    What is populatearrayldb? If it's a method, where are the parenthesis?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: whats wrong

    how do i post code on here so its correctly spaced

    --- Update ---

    public class main
    {
    public static void main(String [] args)
    {
    lyric a = new lyric();
    String[] b = new String[52];
    b = lyric.(populatearrayldb);

    for (int i = 0; i < 52; i++){

    System.out.println("");
    } try
    {
    Thread.sleep(500);

    }
    catch(InterruptedException n)
    {}
    }
    }

    i put () and the error is <identifier> expected

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: whats wrong

    There is a link in my signature on using code tags. Also, you could go to any of the existing posts and press the "reply with quote" button just to see what they did.

    That is not correct syntax at all. The parenthesis go after the method name. Hint: println is a method, and you're calling it correctly (well, if you call printing out a blank String correct).
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Junior Member
    Join Date
    Dec 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: whats wrong

    public class main
    {
    public static void main(String [] args)
    {
    lyric a = new lyric();
    String[] b = new String[52];
    b = lyric.populatearrayldb();

    for (int i = 0; i < 52; i++){

    System.out.println("");
    } try
    {
    Thread.sleep(500);

    }
    catch(InterruptedException n)
    {}
    }
    }



    Is that correct with the ()

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: whats wrong

    Quote Originally Posted by Jdino23 View Post
    Is that correct with the ()
    Well, does it compile? Does it run? Does it do what you want?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: whats wrong

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for newcomers.

    If you don't make the effort to post your code correctly and/or ask and answer specific questions, then you will find trouble getting help here - or anywhere for that matter.

Similar Threads

  1. Whats wrong here??
    By cbplayer in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 16th, 2013, 02:19 PM
  2. WHATS WRONG
    By subodhkr in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 8th, 2012, 07:47 AM
  3. Whats wrong here?
    By Java Sucks in forum What's Wrong With My Code?
    Replies: 4
    Last Post: June 8th, 2011, 08:33 PM
  4. whats wrong?
    By whattheeff in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 25th, 2011, 02:35 PM
  5. could you tell me whats wrong....
    By gonfreecks in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 6th, 2010, 04:35 PM