-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava
More file actions
executable file
·81 lines (40 loc) · 1003 Bytes
/
java
File metadata and controls
executable file
·81 lines (40 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
int, String, double, long
javac \\compile -> *.class
java \\run
```java
public class Hello {
public static void main(String[] args) {
System.out.println("hello world"); \\newline
System.out.print(""); \\ no newline
}
}
```
public class name must be same as file name
only one public class in one file
jshell
CLASSPATH
//
/* ... */
/** ... */
Integer.MAX_VALUE
Integer.MIN_VALUE
Char ''
String ""
int max = x > y ? x : y;
int max = x > y ? (x > z ? x : z) : (y > z ? y : z);
if/else if/else
switch/case/default
while/do...while
for
continue/break
Class <name> = new Class()
class attribute, private, setter, getter
constructor method, same name as class, no return type
pass in value when initiating with new
this, this., this()
all attribute private, with setter getter
at least a no parameter constructor
no print, use return only
optional, getInfo() method
static variable, universal, doesn't require class instance to access
array []