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

Day 7

The document outlines tasks for a summer training program, including: 1. Writing programs to demonstrate regular, static, and method local inner classes, how their objects are formed, and calling their methods. 2. Writing a program with an Outer class containing an Inner class to invoke static and non-static methods to check for compilation errors. 3. Writing a program with an Employee class containing an inner Bill class to instantiate an employee object and manipulate a bill object for that employee.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Day 7

The document outlines tasks for a summer training program, including: 1. Writing programs to demonstrate regular, static, and method local inner classes, how their objects are formed, and calling their methods. 2. Writing a program with an Outer class containing an Inner class to invoke static and non-static methods to check for compilation errors. 3. Writing a program with an Employee class containing an inner Bill class to instantiate an employee object and manipulate a bill object for that employee.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Summer Training Program 2011

DAY 7
1. WAP to show implementation of regular inner classes(how their object is formed

and how to call their method and their outer class method). 2. WAP to show implementation of static inner classes(how their object is formed and how to call their method and their outer class method). 3. WAP to show implementation of method local inner classes(how their object is formed and how to call their method and their outer class method). 4. WAP to show implementation of anonymous inner classes(how their object is formed and how to call their method and their outer class method). 5. Write a class Outer that contains an inner class Inner. The class Outer contains a static method printHello() and a non-static method sayHello(). Invoke these two methods in the non static method speakMsg() and static method broadcast() of Inner class each. Will the code compile successfully? If your code does not compile report the reason for compilation error. 6. A class Employee apart from its usual construct also has an inner class Bill which has following architecture:
String bill_id float bill_amount Public String getDetails() Public void setDetails(String id, float amount)

Write a program to implement how an employee object can be instantiated and thereby for that employee object a bill (object) can be instantiated and manipulated. 7. WAP to show difference between inner class and nested class. 8. WAP to use the variable of a method inside the method local class.
9. WAP to check if inner class is static then its method and variable will show

behaviour like like static or not. 10. WAP of simple regular inner class and perform following operation: a. Accessibility of private variable of outer class, insde the inner class.
b. How to hide the member variable of inner class.

Summer Training Program 2011

c. Check if super keyword will work inside inner class or not. 11. WAP to check if an inner class can be overridden like a method or not. 12. There is an abstract Student class. BTechStudent class and MCAStudent class extend this Student class. The Student class has a method getAssignment() declaration. The signature of the getAssignment() looks like: Public Assignment getAssignment(); Here Assignment is an interface with following features: Public interface Assignment { Public void createAssignment(String id, String details); Public String getAssignmentId(); Public String getAssignmentDetails(); };l Ought to behaviour as expected by the interface Assignment is that every class that implements Assignment should contain two data members: Assignment Id and Assignment details of java.lang.String type. It is upto the classes (BTechStudent and MCAStudent) to implement assignments their way as per their needs. Implement this system using anonymous inner class.

You might also like