2016/6/4

C# sealed vs Java final

FROM:http://stackoverflow.com/questions/10170633/c-sharp-sealed-vs-java-final

回答的很精妙:

That's because final in Java means plenty of different things depending on where you use it whereas sealed in C# applies only to classes.
In Java final can be applied to:
  • classes, which means that the class cannot be inherited. This is the equivalent of C#'s sealed.   

  • methods, which means that the method cannot be overridden in a derived class. This is the default in C#, unless you declare a method as virtual and in a derived class this can be prevented for further derived classes with sealed again.

  • fields and variables, which means that they can only be initialized once. For fields the equivalent in C# is readonly.

自己的github


自己做個備忘,也替自己廣告(雖然這裡平常很冷清)
https://github.com/otaku119

Static vs Sealed Class Difference


From:
http://stackoverflow.com/questions/16217313/static-vs-sealed-class-difference

回答的簡單明瞭:
+-------------------------+---+--------+--------+--------+----------+
|       Class Type        |   | normal | static | sealed | abstract |
+-------------------------+---+--------+--------+--------+----------+
| Can be instantiated     | : | YES    | NO     | YES    | NO       |
| Can be inherited        | : | YES    | NO     | NO     | YES      |
| Can inherit from others | : | YES    | NO     | YES    | YES      |
+-------------------------+---+--------+--------+--------+----------+
 

spring boot Operator SIMPLE_PROPERTY 錯誤

 錯誤訊息範例如下: Caused by: java.lang.IllegalStateException: Operator SIMPLE_PROPERTY on searchDto requires a scalar argument, found class com ....