website/content/ta/spring2018/cpsc220/jan16.md

47 lines
1.1 KiB
Markdown
Raw Normal View History

2020-01-16 02:51:49 +00:00
# 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
```java
/* 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
```java
/**
* 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