Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7034235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:09:40+00:00 2026-05-28T01:09:40+00:00

I want to learn to write method definition in my class. i.e: public int

  • 0

I want to learn to write method definition in my class. i.e:

    public int myMethod()
    {
    //This method is used for ....bla bla bla....
    }

I want to inform user about what methods do.
In .Net you can write this definition and you can see the explanation when you write the method. How can it be done in JAVA ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:09:40+00:00Added an answer on May 28, 2026 at 1:09 am

    Fleshing out some of the other answers.

    The first sentence should be third-person declarative sentence that answers the question “What does the method do,” e.q., “Creates a foobar.” Also, the first sentence is used as the summary comment, so it should be as clear, and concise, as possible.

    For example, if your method read in a file and returned an integer status:

    /**
     * Reads in config file and initializes application.
     *
     * @return Application status; 0 if everything is okay.
     */
    public int myMethod() {
        // ...
    }
    

    IMO adding unnecessary details is just that–unnecessary. Some methods are self-documenting, the canonical example being getters/setters:

    /**
     * Sets first name.
     *
     * @param firstName Name to set.
     */
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    

    Redundant comment. Similarly, well-named methods can avoid needing extensive, or any, docs:

    public List<User> getAllUsers() { ... }
    public User findUserById(Long id) { ... }
    

    IMO unless there’s something actually remarkable, there’s no need to remark.

    HTML is used to mark up Javadocs, but IMO it’s a good idea to format it in such a way that it can be read in multiple formats (editor, IDE, Javadocs, etc.) so I tend to indent and use whitespace to make sure I can see everything in plain text as well as rendered.

    The standard doclet assumes HTML: whitespace is ignored unless made explicit via <p> or <br> tags.

    /**
     * Builds and returns the current list of ingredients.
     *
     * <p>
     *   <b>Note:</b> Initializes ingredient information if necessary.
     * </p>
     */
    

    Useful links:

    • javadoc program docs
    • How to write javadocs
    • Requirements for writing Java API specs
    • My own take on Javadocs and documentation in general (includes some lesser-used Javadoc tricks)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to learn to write a thread pool in Java Can anyone point
I want to learn how to play with RFID... Read it, write it, scan
I'm building my own String class and I want to write my own replace
I want to learn about Interface Builder in association with Xcode. I know C
I want to learn how to create truly robust applications in .net - ones
I want to learn how to use Struts 2 and I created a simple
I want to learn the answer for different DB engines but in our case;
I want to learn lLinux Kernel programming. What would be the starting points for
I want to learn how to process XML with namespaces in E4X so basically
I want to learn to program in a UNIX/Linux environment. I'll be using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.