Class, Object and Methods in java Questions and Answers

Read tutorials from Class, Object and Methods in java


Question List:

1. What do you mean by Object?

2. Define class?

3. What is Singleton class?

4. What do you mean by Constructor?

5. List the three steps for creating an Object for a class?

6. Define composition?

7. What is Method/function overloading?

8. What is Method/function overriding?

9. Difference between Overloading and Overriding?

10. What is final class?

11. Can you write a Java class that could be used both as an applet as well as an application?

12. What's the difference between constructors and other methods?

13. Can you call one constructor from another if a class has multiple constructors?

14. What is the purpose of the System class?

15. What is the default value of an object reference declared as an instance variable?

16. Why do we need wrapper classes?

17. Can constructor be inherited?

18. Does Java allow Default Arguments?

19. What is Nested top-level class?

20. What is the GregorianCalendar class?

21. What is the SimpleTimeZone class?

22. What is the difference between the size and capacity of a Vector?

23. Can a vector contain heterogenous objects?

24. What is difference between Path and Classpath?

25. Can a class declared as private be accessed outside it's package?

26. What are the restriction imposed on a static method or a static block of code?

27. Which object oriented Concept is achieved by using overloading and overriding?

28. What is an object's lock and which object's have locks?

29. If a method is declared as protected, where may the method be accessed?

30. What is the difference between inner class and nested class?

31. What restrictions are placed on method overriding?

32. What is constructor chaining and how is it achieved in Java?

33. What is the default constructor?

34. Rules for creating Java constructor

35. When is a constructor called

36. Types of Java constructors in Java

37. What is the purpose of a default constructor?

38. Why use the parameterized constructor in Java?

39. What is Constructor Overloading in Java?

40. Difference between constructor and method in Java

41. Can constructor perform other tasks instead of initialization?