Java Flashcards
Learn java
When would one use a query parameter over a stashed field (stashed in the header)?
When one wants to allow for a value of 0. Stashed parameters do not allow that.
What is the entry point of a java class?
public static void main(String[] args)
What’s the syntax to create a Set of the numbers 1, 2, 3?
Set<Integer> set = Set.of(1, 2, 3)</Integer>
What are access modifiers, and what are they in Java?
Control which other classes can access a particular area of code.
Private, public, protected, and default.
What is this syntax? MyObject<K,V>?
Generics.
Syntax to create an error when a bad input is found.
throw new IllegalArgumentException(“new error”)
What’s the difference between raise and throw?
Raise is for python, throw is for java.