Lecture for January 16 2018
Comments
You can use multi-line comments or single line comments to note about a piece of code. This helps you so that you don’t forget what was happening in the code
/* Multi Line Comment
I am multiple lines woo!
*/
System.out.println("Hello"); // I am an inline comment
Javadocs
This is a standardized method in Java to describe your functions and classes
/**
* This is a Javadoc comment. A description of your class should appear here
* @author Brandon
* @version 2018
*/
public class Example{
/** Another Javadoc comment.
* A description of your program should go here
*/
public static void main(String[] args) {
}
}
Variables
Convention in Java is for all of your functions/method names to be lowercase.
Class names should be title cased, each word is capitalized ex: IntroExample
Java API
The Java API is publicly accessible and is extremely useful for finding methods in existing classes.
The API documentation for the String
class is located here: https://docs.oracle.com/javase/8/docs/api/index.html?java/lang/String.html