publicstaticvoidmain(Strings[] args){ int a[] = {2, 3, 1}; Arrays.sort(a[]); }
Belongs to class rahter than object of the class
Can be invoked without creating an instance of a class Can access and update static member of the class
Cannot access non-static members
the same, cannot access non-static members.
Static class Outer class cannot be static
Inner class can be static ** User inner class without creating an instance of outer class
static inner class isolated from enclosing class instance.
Run only one time before constructor/mmain method called
No return No arguments
No this/super support
Final Final Class: class cannot be extended
Final method: method cannot be override ** Final variable: variable can only be assigned once. (Reference!)
Data Structures What you’ll learn in this course: ArrayList
LinkedList HashTable/Map/Set
Tree Stack/Queue
Heap
ArrayList in Jave - method review create - List list = new ArrayList<>(); add - list.add(e) - return: boolean remove - list.remove(index) - return: element removed get - list.get(index) - return element size - list.size() - return: int
Compute the greatest common divisor of two nonnegative integers p and q as follows: if q is 0, the answer is p. If not, divide p by q and take the remainder r. The answer is the greatest common divisor of q and r.
Java-language description
```java public static int gcd(int p, int q) { if (q == 0) return p; int r = p % q; return gcd(q, r); }
Respond when Angular (re)sets data-bound input properties. The method receives a SimpleChanges object of current and previous property values. Called before ngOnInit() and whenever one or more data-bound input properties change.
ngOnInit()
Initialize the directive/component after Angular first displays the data-bound properties and sets the directive/component’s input properties. Called once, after the firstngOnChanges().
ngDoCheck()
Detect and act upon changes that Angular can’t or won’t detect on its own. Called during every change detection run, immediately after ngOnChanges() and ngOnInit().
ngAfterContentInit()
Respond after Angular projects external content into the component’s view. Called once after the first ngDoCheck(). A component-only hook.
ngAfterContentChecked()
Respond after Angular checks the content projected into the component. Called after the ngAfterContentInit() and every subsequent ngDoCheck(). A component-only hook.
ngAfterViewInit()
Respond after Angular initializes the component’s views and child views. Called once after the first ngAfterContentChecked(). A component-only hook.
ngAfterViewChecked()
Respond after Angular checks the component’s views and child views. Called after the ngAfterViewInit and every subsequent ngAfterContentChecked(). A component-only hook.
ngOnDestroy
Cleanup just before Angular destroys the directive/component. Unsubscribe Observables and detach event handlers to avoid memory leaks. Called just before Angular destroys the directive/component.