0% found this document useful (0 votes)
4 views19 pages

Programming Exercises with Classes and Methods

The document contains 17 questions asking to write Java programs that demonstrate various OOP concepts like classes, objects, inheritance, polymorphism, abstraction, and packages. The questions cover topics such as class and object usage, conditional statements, loops, arrays, methods, constructors, inheritance, interfaces, abstract classes, and packages.

Uploaded by

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

Programming Exercises with Classes and Methods

The document contains 17 questions asking to write Java programs that demonstrate various OOP concepts like classes, objects, inheritance, polymorphism, abstraction, and packages. The questions cover topics such as class and object usage, conditional statements, loops, arrays, methods, constructors, inheritance, interfaces, abstract classes, and packages.

Uploaded by

Aaliya khan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Ques1.

Write a program to perform multiplication and addition of two numbers


by using class and object.
Ques2. Write a program which prints "PASS" if variable "mark" is more than or
equal to 50; or prints "FAIL" otherwise.
Ques3. Write a program using switch statement to display days of the week.
Ques4. Write a program which prints "Odd Number" if the int variable “number”
is odd, or “Even Number” otherwise.
Ques 5. Write a program which prints "ONE", "TWO",... , "NINE", "OTHER" if the
int variable "number" is 1, 2,... , 9, or other, respectively. Use
(a) a "nested-if" statement
(b) use a switch case statement
Ques 6. W.A.P to generate Fibonacci series.
Ques7. W.A.P to add elements of array.
Ques8. Write a program to implement method overriding.
Ques9. Write a program to take an input from user and check given number is
prime or not.
Ques10. Write a program to find out the value of square root using sqrt function.
Ques11. Write a program for implementation of nested interface.
Ques12. Write a program for inheriting the property of Vehicle class
having method Bike and Car into Class Motor and Cycle.
Ques13. Write a program to overload volume method to find out
volume of cube and cuboid.
Ques14. Write a program to find out the Area and perimeter of
rectangle using super keyword.
Ques15. Write a program to design a class using abstract Methods and
Classes.
Ques16. Write a program to implement multiple inheritance by using
Interface.
Ques17. Write a program to create a package of your name and use that package
in a class.
Ques19. Write a program to implement parameterized constructor.

You might also like