@placement_fellas telegram (2)
@placement_fellas telegram (2)
Q-5. Can we have any other return type than void for main method?
Ans: No, Java class main method can have only void return type for the program
to get successfully executed. Nonetheless , if you absolutely must return a value to at the
completion of main method , you can use System.exit(int status).
Q-6. I want to re-reach and use an object once it has been garbage
collected. How it's possible?
Ans: Once an object has been destroyed by garbage collector, it no longer exists
on the heap and it can't be accessed again. There is no way to reference it again
@PLACEMENT_FELLAS ON TELEGRAM
can I implement this logic?
Ans: This can be implemented by use of the concept of synchronization. Database related code
can be placed in a method which has synchronized keyword so that only one thread can access
it at a time.
Q-10. What’s the variance amid an Abstract Class and Interface in Java?
Ans: The main difference amid an abstract class and interface is that a boundary cans only own
assertion of public static approaches with no existing application while an abstract class can
have associated with any admittance specifies (i.e. public, private etc.) with or without real
implementation. Additional key variance in the usage of abstract classes and lines is that a class
which gears an interface must contrivance all the approaches of the interface while a class
which receives from an abstract class doesn’t need execution of all the methods of its
superclass. A class can instrument numerous interfaces but it can spread only one abstract
class.
Q-13.What is enumeration?
Ans. It is an interface you can use to access original data structure from which the enumeration
is obtained.
@PLACEMENT_FELLAS ON TELEGRAM
Q-14. What's the base class in Java from which all classes are derived?
Ans: java.lang.object
@PLACEMENT_FELLAS ON TELEGRAM
Q-22. What is the difference between ArrayList and vector?
Ans: An ArrayList is not suitable for working in a thread based environment. A vector is built for
thread-based executions. ArrayList does not support legacy functions whereas a vector has
support for legacy functions.
@PLACEMENT_FELLAS ON TELEGRAM