65 761
Assignments Done
99,3%
Successfully Done
In October 2018

Answer to Question #3605 in Java | JSP | JSF for Y mukundareddy

Question #3605
4. Write a document what is comments and how many types of comments are there in java.
Expert's answer
We all use comments to describe the Java code. There are three types if comments in
Java as demonstrated in this Java tutorial by SUN:
// text

where the compiler ignores everything from
//
to the end of the line
/* text */

where the compiler ignores everything from
/*
to
*/
and
/** documentation */

which is ignored by the compiler the same way as the previous comment type. This one
is a special comment as this indicates a documentation comment. The JDK javadoc tool uses doc comments when preparing automatically generated documentation.
I am not going to tell you how to use them. There are many articles and
documentation written about that. We all know how to use them and most of us use
them on a daily basis. Over time we can develop a stereotype. Mine looks like
this:

/** first name */
private String firstName;

/** last name */
private String lastName;

/**
* Constructs and returns the full name
* @return full name
*/
public String getFullName() {
if (firstName == null) {
if (lastName == null) {
// user does not have a name specified
return "[no name]";
}
else {
return lastName;
}
}
else {
if (lastName == null) {
return firstName;
}
else {
// construct full name from first and last name
return firstName + " " + lastName;
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions