summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbdus <abdus@abdus.net>2021-05-04 12:34:03 +0530
committerAbdus <abdus@abdus.net>2021-05-04 12:34:03 +0530
commit646826d0dec3cbd5bc1eea13162fe4fe9e4b0b40 (patch)
tree955fd8299ebfb49043af2b36ef8a042aa99b738c
parent9a8ccf24048f0718b7df39d2548fa6e9fa6efa40 (diff)
downloadabdus.net-646826d0dec3cbd5bc1eea13162fe4fe9e4b0b40.tar.bz2
abdus.net-646826d0dec3cbd5bc1eea13162fe4fe9e4b0b40.zip
new notes
-rw-r--r--.vim-session.vim14
-rw-r--r--content/notes/java-basics.md22
2 files changed, 32 insertions, 4 deletions
diff --git a/.vim-session.vim b/.vim-session.vim
index 4065e50..d0a97ea 100644
--- a/.vim-session.vim
+++ b/.vim-session.vim
@@ -7,7 +7,7 @@ if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
let s:wipebuf = bufnr('%')
endif
set shortmess=aoO
-badd +295 content/notes/java-basics.md
+badd +388 content/notes/java-basics.md
argglobal
%argdel
$argadd content/posts/typescript-webpack-setup.md
@@ -35,12 +35,18 @@ normal! zo
normal! zo
307
normal! zo
-let s:l = 388 - ((27 * winheight(0) + 24) / 48)
+401
+normal! zo
+402
+normal! zo
+404
+normal! zo
+let s:l = 410 - ((25 * winheight(0) + 24) / 49)
if s:l < 1 | let s:l = 1 | endif
exe s:l
normal! zt
-388
-normal! 031|
+410
+normal! 077|
tabnext 1
if exists('s:wipebuf') && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
silent exe 'bwipe ' . s:wipebuf
diff --git a/content/notes/java-basics.md b/content/notes/java-basics.md
index 86b98a7..e5ae735 100644
--- a/content/notes/java-basics.md
+++ b/content/notes/java-basics.md
@@ -386,3 +386,25 @@ str.append(world);
to check whether two arrays are equal, Arrays.equals() method can be used:
`Arrays.equals(arr1, arr2);`. Similarly for nested arrays, use
`Arrays.deepEquals(arr1, arr2);`
+
+## Rules for method overloading
+
+1. access modifiers can allow more, but not less, access than the overriden
+ method. trying to convert a `protected` method to `private` would result in
+ compile-time error
+2. methods declared as `final` cannot be overriden
+3. `static` methods cannot be overriden
+4. `private` method cannot be overriden
+5. overriden method must have same return type (or should be a sub-type)
+6. constructors cannot be overriden
+7. exception handling
+ 1. subclass overriden method cannot throw checked exception if superclass
+ method does not throw any exceptions
+ 2. if superclass method throws an exception, subclass overriden method can
+ throw the same exception or subclass exception. there is not problem is
+ subclass method does not throw any
+
+| Overriding | Overloading |
+| :------------------------------------------------------------------------------------- | :------------------------------------------- |
+| runtime polymorphism | compile-time polymorphism |
+| is about same method, same signature but different class connected through inheritance | is about same method but different signature |