Assignment No.2: Subject Teacher (Prof. M.B. Patil)
Assignment No.2: Subject Teacher (Prof. M.B. Patil)
1. Define a class and object. Write syntax to create class and object with an example.
2. What is method overloading? Give one example.
3. What is Vector? How it differs from array? Explain.
4. Explain the substring(), concate(), replace() methods of class string.
5. What are the applications of wrapper classes? Explain Integer wrapper class methods.
6. Describe following String class methods with example
(a)length() (b)equals() (c)charAt() (d)compareTo()
7. What is constructor? State its types. Explain constructor overloading with example.
8. Explain following methods of vector class:
(1) elementAt() (2) removeElement() (3) insertElementAt() (4)addElement()
9. Describe all visibility controls.
10. What is the use of “this” keyword? Explain its use with example.
11. Write a short note on Static fields and static methods.
12. What is garbage collection in java? Explain finalize( ) method.
13. Give the syntax of creating array. What are its types?
14. Explain Object Class and its methods.
15. Give the difference between == and equals( ).
16. Define Wrapper class.
Programming Exercise
1. Write a program to define a class student with rollno and name. Derive class
attendance with member as present_days. Write method to calculate and print
average attendance assuming total days as 180.
2. Define class „Employee‟ with data member empid, name and salary. Accept data for
5 objects and print it.
3. Write a program to accept as many integers as user wants in a vector. Delete specific
element and display remaining list.
4. Write a java program to implement visibility controls such as public, private,
protected access modes. Assume suitable data, if any.
5. Define a class person with data member as Aadharno, name, Panno implement
concept of constructor overloading. Accept data for 5 object and print it.
Subject Teacher