Comments in Android

Introduction

There are three types of comments you can use in Android Studio

  1.  Line Comment - //
  2. Block Comment - /* */
  3. JavaDoc - /** */
This post is all about different tips and tricks which I found over the years of using JavaDocs from various projects.

JavaDoc is a utility that Java, Android or Kotlin developers can use with the help of installed Java SDK to generate code documentation.

This is a simple example of using JavaDoc comments in Android Studio.

With the help of the JavaDoc comments defined for setStartTime method we can get this kind of information snippet

Tips

  • You can use a file of a project with another file with the help of @link annotation used in JavaDoc. Syntax is {@link FileName}
 /**
* A ViewModel used for the {@link ChronoActivity2}.
*/
  • You can define parameter names of a method with the help of @param annotaion. e.g.
 * @param startTime value for startTime
  • To Be Continued...

Reference

Comments

Popular posts from this blog

SSLSocketFactory in Android

Dagger-Hilt in Android

How to write files in Android?