Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Makeup for Lab 14: Inner Classes Q1. Given the following code: class OuterClass int data 3; public OuterClass(O/constructor class InnerClass int data27; void method) (

image text in transcribed
Makeup for Lab 14: Inner Classes Q1. Given the following code: class OuterClass int data 3; public OuterClass(O/constructor class InnerClass int data27; void method) ( System.out.println("data from OuterClassdata); System.out.println( data2 from InnerClassdata2); lend of InnerClass Modify OuterClass to create another inner class within the InnerClass itself in such a way that the following test class: public class InnerClassDemo( public static void main(Stringl] args) ( OuterClass oc new OuterClass); OuterClass.InnerClass ic oc.new InnerClass); OuterClass. InnerClass.InnerInnerClass iic-ic.new InnerInnerClassO System.out.println( Access data from outer class oc.data); System.out.println("Access data2 from inner class ic.data2); System.out.println( Access data3 from innerinner classiic.data3); ic.method); iic.method2); It does generate the following output Access data from outer class 3 Access data2 from inner class7 Access data3 from innerinner class data from OuterClass 3 data2 from InnerClass7 data from OuterClass -3 data2 from InnerClass-7 data2 from InnerInnerClass 12 12 Q2. Create a class that has a static inner class and a method local dlass. Make instances of each inner class. Create code that accesses the inner classes' members from the outer class. Create code that accesses the outer class's members from within the inner classes Q3: solve postiab-14 and submitted with this lab. Page 1 of 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

1. Who should participate and how will participants be recruited?

Answered: 1 week ago