Java Language Interview Question and Answers
51. |
What type of parameter passing does Java support? |
|
In Java the arguments are always passed by value. |
|
|
52. |
What is singleton? |
|
- It is one of the design pattern.
- This falls in the creational pattern of the design pattern.
- There will be only one instance for that entire JVM.
- You can achieve this by having the private constructor in the class.
|
|
|
53. |
What is Locale? |
|
A Locale object represents a specific geographical, political, or cultural region. |
|
|
54. |
What is the difference between constructors and normal methods? |
|
Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times and it can return a value or can be void. |
|
|
55. |
What is the difference between static and non-static variables? |
|
A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance. |
|
|
123456789101112
Page 11 of 12