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: Trying to print a method for a table

  1. #1
    Junior Member square259's Avatar
    Join Date
    Mar 2012
    Posts
    2
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Trying to print a method for a table

    I'm trying to print a method for a table and I'm not sure what I'm doing wrong.
    I did this:

    {
    public static void report Table();
    { System.out.printf("Report");
    System.out.printf("name " + "value " + "message"); }

    then I get an error message of
    Report.java:33: error: ';' expected
    report Table();
    ^
    Report.java:50: error: illegal start of expression
    public static void report Table();
    ^
    Report.java:50: error: illegal start of expression
    public static void report Table();
    ^
    Report.java:50: error: ';' expected
    public static void report Table();
    ^
    Report.java:50: error: ';' expected
    public static void report Table();
    ^
    What am I doing wrong?


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

    Default Re: Trying to print a method for a table

    Method names cannot contain spaces, and if you want to define the method body (which it looks like you do), then you shouldn't put a semicolon after the method declaration.
    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!

Similar Threads

  1. Calling a print method from another class (printing array)
    By Kaldanis in forum Object Oriented Programming
    Replies: 7
    Last Post: November 25th, 2011, 12:32 PM
  2. Method to print n x n box
    By HeroFlame in forum Loops & Control Statements
    Replies: 3
    Last Post: November 18th, 2011, 08:33 AM
  3. Method for a table for calculation - help!
    By terripwilliams in forum Loops & Control Statements
    Replies: 1
    Last Post: October 26th, 2011, 11:23 AM
  4. HELP random generator with roll() and print() method
    By disc_dido in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 18th, 2011, 01:50 PM
  5. Method to print a diamond
    By snowMac in forum Algorithms & Recursion
    Replies: 1
    Last Post: March 8th, 2011, 03:18 AM