-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava_tips.txt
More file actions
20 lines (19 loc) · 790 Bytes
/
java_tips.txt
File metadata and controls
20 lines (19 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Compile - $javac File.java
Start program - $java File - make sure that class name and file name are same and that it has public static void main(String[] args)
Output - System.out.printf("AAA %s %d %.2f\n", bla, 10, 2.33);
Input
File output
File input
Min, max int & long - Integer.MIN_VALUE, Integer.MAX_VALUE, Long.MIN_VALUE, Long.MAX_VALUE
Check if number is largest / smallest - int bla = Math.max(bla, other) int boo = Math.min(boo, other)
java.util.ArrayList
java.util.Arrays
java.util.Collections
array.length, arraylist.size(), string.length()
HashMap
Set
Queue
java.util.Stack - push(), pop(), isEmpty()
PriorityQueue
Sort - Arrays.sort(array) Collections.sort(list) Collections.sort(list, comparable)
Comparable<T> - override int compareTo(T other) {return this.bla - other.bla}