Results 1 to 3 of 3

Thread: java

  1. #1
    saikumar is offline Member
    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Question java

    hi sir i am trying below program i getting error ie"
    A.java:5: illegal start of expression
    public static void nPrintln(String message, int n)
    ^
    A.java:12: ';' expected
    ^
    2 errors"

    please help me
    class A
    {
    public static void main(String[] args)
    {
    public static void nPrintln(String message, int n)

    {
    n=5;
    for (int i = 0; i < n; i++)
    System.out.println(message);
    }

    }

    }

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,560
    Blog Entries
    7
    Rep Power
    21

    Default Re: java

    That's a method in the scope of another method body; you can't do that in Java.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    saikumar is offline Member
    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

Posting Permissions

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