1. class : Keyword used to specify a class.
2. interface : Keyword used to specify an interface.
3. extends : Indicate the superclass that a subclass is extending.
4. final : It makes impossible to
i) Extend a class
ii) override a method
iii) reinitialize a variable.
5. abstract :
i) If abstract is used to declare a class then it can’t be instantiated.
ii) If abstract used in a method then must be implemented by nonabstract subclass.
6. implements : To indicate the interfaces that a class will implement.
7. new : Used to instantiate an object by invoking the constructor.
8. native : Indicates that a method is written in a platform-dependent language.
9. synchronized : Indicates that a method can be accessed by only one thread at a time.
10. static : Makes a variable or a method belong to a class as opposed to an instance.
11. transient :
i) It Prevents fields from ever being serialized.
ii) Transient fields are always skipped when objects are serialized.
12. volatile : Indicates a variable may change out of sync because it is used
in threads.
Subscribe to:
Post Comments (Atom)
private methods on Interface
Private methods can be used on interface from java 9. This will help in Avoiding code duplication. Ensuring code re-usab...
-
When an object is no longer referred to by any variable, java automatically reclaims memory used by that object. This is known as...
-
1. If a name has more the one word, then except the first word others should start with the uppercase. Examples : setLayout, addLayoutCompon...
-
Step 1: Create a shortcut for eclipse.exc Step 2: Right click eclipse short cut and add target value with “-vm "C:\Program Files\J...
No comments:
Post a Comment