Compaq Placement Paper For Freshers Part-4
31. What are the different scopes for java variables?
The different scopes for java variables are as follows:-
32. What is the default value of the local variables?
When the local variables are not initialized explicitly the java compiler will not compile. And it will not initialize any default value for these local variable.
33. Can main method be declared final?
The main method can be declared final with the addition of public static.
34. Does Java provide any constructor to find out the size of an object?
There is no sizeof operator in java. It is not possible to determine the size of the object directly in java.
35. What is the Map interface?
Map is an object which helps to map the keys to values. It is not possible to have duplicate keys. It is essential that each key should map to a one value.
Three Map implementations are
36. What is collection Views?
Collection view is a metho that is used to view map as a collection. This can be done in three ways:-
37. What is multimaps?
Multimap is also like map which map key to multiple values. But there is no separate interface for multimap in Java since it is used quiet often. It’s much more simple to use map whose values to list instance as a multimap.
38. What is the SimpleTimeZone class?
It is a subclass of Time zone which represent time zone that could be used with Gregorian calendar. It doesn’t handle any changes.
public class SimpleTimeZone
39. Is &&= a valid Java operator?
no &= is a valid operator not &&=
40. Is “abc” a primitive value?
Abc is a string object it is not primitive value.