Declarations
& Access Modifiers:
Java Source File
Structure
- Import
statement
- Static
import statement
- Package
statement
Modifiers
(Class Level Modifiers & Member Level Modifiers)
- Public
- Private
- Protected
- Default
- Static
- Abstract
- Final
- Strictfp
- Native
- Transient
- Synchronized
- Volatile
3. Interfaces
After
Completion This WrokShop You Can Answer All The Below Questions:
Java Modifiers:
1) For the top level classes which modifiers
are allowed?
2) Is it possible to declare a class as static, private, protected?
3) What are extra modifiers applicable inner classes when compared
with outer classes?
4) What is a final class?
5) Explain the differences between final, finally& finalize?
6) Is every method present in final class is final?
7) Is every variable present inside a final class is final?
8) What is abstract class?
9) What is abstract method?
10) If a class contain at least one abstract method is it required
to declared that class compulsory abstract?
11) If a class doesn’t contain any abstract method is
it possible to declare that class as abstract?
12) Whenever we are extending abstract class is it compulsory
required to provide implementation for every abstract method
of that class?
13) Is final class can contain abstract method?
14) Is abstract class can contain final methods?
15) Can u give example for abstract class which doesn’t
contain any abstract method?
16) Which of the following modifiers combinations are legal
for methods?
- public – static
- static
– abstract
- abstract - final
- final - synchronized
- synchronized - native
- native - abstract
17) Which of the following modifiers combinations are legal
for classes?
18) What is
the difference between abstract class & interface?
19) What is strictfp modifier?
20) Is it possible to declare a variable with strictfp?
21) abstract -strictfp combination, is legal for classes or methods?
22) Is it possible to override a native method?
23) What is the difference between instance & static variable?
24) What is the difference between general static variable and
final static variable?
25) Which modifiers are applicable for local variable?
26) When the static variables will be created?
27) What are various memory locations of instance variables, local
variables and static
variables?
28) Is it possible to overload a main method?
29) Is it possible to override static methods?
30) What is native keyword & where it is applicable?
31) What is the main advantage of the native keyword?
32) If we are using native modifier how we can maintain platform
independent nature?
33) How we can declare a native method?
34) Is abstract method can contain body?
35) What is synchronized keyword where we can apply?
36) What are advantages & disadvantages of synchronized keyword?
37) Which modifiers are the most dangerous in java?
38) What is serialization & Explain how its process?
39) What is deserialization?
40) By using which classes we can achieve Serialization &
deserialization?
41) What is Serializable interface & explain its methods?
42) What is a marker interface & give an example
43) Without having any method in Serializable interface, how we
can get serializable ability
for our object?
44) What is the purpose of transient key word & explain its
advantages?
45) Is it possible to serialize every java object?
46) Is it possible to declare a method a class with transient?
47) If we declare static variable with transient is there any
impact?
48) What is the impact of declaring final variable a transient?
49) What is volatile variable?
50) Is it possible to declare a class or method with volatile?
51) What is the advantage & disadvantage of volatile modifier?
Interfaces:
1.
What is interface?
2. What is difference b/w interface and abstract class?
3. When we should go for interface and abstract class and concrete
class?
4. What modifiers applicable for interfaces?
5. Explain about interface variables and what modifiers are
applicable for them?
6. Explain about interface methods and what modifiers are applicable
for them?
7. Can java class implement any number of interfaces?
8. If two interfaces contains a method with same signature but
different return types, then how we can implement both interfaces
simultaneously?
9. Difference b/w extends and implements keyword?
10. We cannot create an object of abstract class then what is
necessity of having constructor inside abstract class?
11. What is a marker interface? Give an example?
12. What is adapter class and explain its usage?
13. An interface contains only abstract methods and an abstract
class also can contain only abstract methods then what is the
necessity of interface?
14. In your previous project where you used the following Marker
interface, abstract class, interface, adapter class?