0% found this document useful (0 votes)
18 views2 pages

Oop - Unit 3 - Imp Question

Oop imp

Uploaded by

panchaldev.1454
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Oop - Unit 3 - Imp Question

Oop imp

Uploaded by

panchaldev.1454
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Unit 3: Classes, Objects and Methods

1. Differentiate between constructor and method of a class.


2. Explain different Visibility modifiers.
3. Explain following terms with example: (A) Nested Class (B) Anonymous Inner Class
4. Explain keywords private and protected.
5. Explain the keywords: 1. finalize () method 2. Recursion 3. Static
6. Explain Wrapper Classes in java.
7. The method main is a static method. Why?
8. Explain keyword this
9. Write Explain method parseInt.
10. List two characteristics of an abstract class.
11. Write use of keyword import.
12. Declare a class called Book having book title & author name as members. Create a
sub-class of it, called BookDetails having price & current stock of book as members.
Create an array for storing details of n books. Define methods to achieve following:
- Initialization of members
- To query availability of a book by author name / book title
- To update stock of a book on purchase and sell Define method main to show usage
of above methods.
13. It is required to compute SPI (semester performance index) of n students of a class for
their registered subjects in a semester. Assume that all students register for 6 subjects
and each subject carry 5 credits. Also, follow GTU convention and method for
computation of SPI. Declare a class called student having following data members:
id_no, grades_obtained and spi. Define constructor, display and calculate_spi methods.
Define main to process data of n students
14. Define a recursive method for computing x raised to power y by doing repetitive
multiplication where x and y are positive integer numbers. Define main to use above
method.
15. Write a complete program to read from console up to n lines or until “quit” is entered.
The lines entered are displayed on the screen after reading all lines. The program also
counts lines beginning with character ‘A’ or ‘E’ as first letter.
16. Explain following with example: i) Finalize() ii) static
17. The abstract vegetable class has three subclasses named Potato, Brinjal and Tomato.
Write a java prog. That demonstrates how to establish this class hierarchy. Declare one
instance variable of type String that indicates the color of a vegetable. Crete and display
instances of these objects. Override the toString() method of object to return a string
with the name of vegetable and its color.
18. Define time class with hour and minute. Also define addition method to add two time
objects.
19. Write a program to create circle class with area function to find area of circle.
20. Explain garbage collection and finalize method in JAVA.
21. Explain constructor overloading using example.
22. What makes a Signature of method?
23. When must a class be declared abstract?
24. What does static import do?
25. How would you define a group of constant that will be used by many classes?
26. What is purpose of static and this keyword with example.

You might also like