Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Java Notes
/*
Java Program:
Made up of one or more classes
A class contains one or more methods
Everything is within a class
*/
public class Learning {
public static void main(String[] args) {
}
}
/*
Identifiers:
An identifier can be made up of letters, digits, underscore, and the dollar sign (Dont use the dollar sign)
Identifiers cannot begin with a digit
Java is case sensitive
Start class names with a capital letter (Camel Case)
*/
/*
Reserved Words:
class
*/
/*
Whitespace:
Whitespace does not matter
*/
/*
Object:
Classes are used to create objects
Must use "new" keyword to create an object
*/
/*
Abstraction:
Hides detail
*/
/*
String concatenation
The plus (+) is also used for arithmetic addition
*/
/*
Quotes:
Single quotes are a primitive character
Double quotes are a string
*/
/*
Escape Sequence:
If you have an weird characters in strings use backslash (\) as an escape character
*/
/*
Variables:
A variable is a name for a location in memory
Must state the type of variable
integer (int)
double (double)
float (float)
byte (byte)
long (long)
short (short)
character (char) (Must use single quotes '')
boolean (boolean) (Must take "true" or "false")
Constants:
Appending "final" before the variable name makes the variable constant (cant re-assign a value)
*/
/*
Attributes:
Similar to variables
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.