int variable integer
double variable for fraction
char variable for single character
String variable for text
boolean variable for true of false statement
final int … variable from which the value can’t be changed, variable in capitals
Math.pow(a,b) a to the power of 3
Math.sqrt(a) the square root of a
Math.sin/cos/tan(a) the sine / cosine / tangent of a
Math.PI the number 𝜋
Math.round(a*b) rounds of the answer
Math.log(a) the natural logarithm of a
Math.exp(a) e to the power of a
Math.max/min(a,b) the maximum / minimum value of a and b
Math.abs(a) the absolute value of a
aEb is equal to 𝑎 ∗ 10!
a%b a divided by b, the remainder term is given
a ++ is equal to a = a + 1
int a = (int) b convert variable b from one type to integer
“…” + “…” + X combine variables and text
X.substring(a,b) take a portion of string X, a is the starting index, b the end index (exclusive)
X.substring(a) take a substring of X, starting from index a, to the end
X.length() take the length of a string
X.charAt(a) the character at spot a of X is taken as ascii code
Scanner in = new Scanner(System.in) needed for reading line
in.nextInt() read the integer
in.nextDouble() read the double
in.next() read the string
in.nextLine() read the line
in.hasNextInt() check if the entered value is an integer
X.isEmpty check if the value of X is empty
X.toLowerCase() will get rid of all the capitals in the string X
\u20AC euro sign, placed inside “ “
\n an enter, placed inside “ “
(“%5.2f”, X) will place the floating number X after 5 spaces and rounded off to 2 decimals,
placed after System.out.printf
(“%5d/s”, X) will place the integer / string X after 5 spaces
Integer.parseInt(X) will change the string number X to an interger
X == Y check if X and Y are the same (will be true or false)
X>/<Y check if X is larger / smaller than Y (will be true or false)
X >= / <= Y check if X is equal or larger / smaller than Y (will be true or false)
X != Y check if X is not equal to Y (will be true or false)
X.equals(“…”) check if the string X contains the text “…” (will be true or false)
A && B check if A and B are true (will be true or false)
A || B check if A or B is true or both true (will be true or false)
!A will change A from to true to false if A was true, or the other way around
int/String/double[] A; create an array called A containing integers / strings / doubles
int[] A = new int[a]; create an array called A containing ‘a’ integers
int[] A = {a, …}; create an array called A with the elements ‘a, …’
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller LeonVerweij. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $6.47. You're not tied to anything after your purchase.