Skip to Content, PHP, MySQL, Javascript, Ajax, Htacces

HeadStrong Java Placement Paper For Freshers Part-2

Be First!

head strong11. What are the access modifiers in Java?

There are 3 access modifiers. Public, protected and private, and the default one if no identifier is specified is called friendly, but programmer cannot specify the friendly identifier explicitly.

12. What is a wrapper class?

They are classes that wrap a primitive data type so it can be used as a object

13. What is a static variable and static method? What’s the difference between two?

The modifier static can be used with a variable and method. When declared as static variable, there is only one variable no matter how instances are created, this variable is initialized when the class is loaded. Static method do not need a class to be instantiated to be called, also a non static method cannot be called from static method.

14. What is garbage collection?

Garbage Collection is a thread that runs to reclaim the memory by destroying the objects that cannot be referenced anymore.

15. What is abstract class?

Abstract class is a class that needs to be extended and its methods implemented, aclass has to be declared abstract if it has one or more abstract methods.

16. What is meant by final class, methods and variables?

This modifier can be applied to class method and variable. When declared as final class the class cannot be extended. When declared as final variable, its value cannot be changed if is primitive value, if it is a reference to the object it will always refer to the same object, internal attributes of the object can be changed.

17. What is interface?

Interface is a contact that can be implemented by a class, it has method that need implementation.

18. What is method overloading?

Overloading is declaring multiple method with the same name, but with different argument list.

19. What is method overriding?

Overriding has same method name, identical arguments used in subclass.

20. What is singleton class?

Singleton class means that any given time only one instance of the class is present, in one JVM.



Leave a Reply