gs gs111 Types of Classes (Using Java) - Nested Class - Quiz No.1
gs gs111 OOP Object Oriented Programming Java Quiz
This quiz belongs to book/course code gs gs111 OOP Object Oriented Programming Java of gs organization. We have 178 quizzes available related to the book/course OOP Object Oriented Programming Java. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Types of Classes (Using Java). NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
class Outer { void print() { System.out.println("Outer"); } class Nested { void print() { System.out.println("Nested"); } } } class MainCall { public static void main(String[] args) { Outer i = new Outer(); Outer.Nested j = i.new Nested(); i.print(); j.print(); } }
Outer Inner
Inner Outer
Outer Outer
Inner Inner
class Outer { int x = 98; class Nested { void print() { System.out.println(this); } } } class MainExecution { public static void main(String[] args) { Outer i = new Outer(); Outer.Nested j = i.new Nested(); j.print(); } }
class Outer { int x = 10; class Nested { int y = 20; class Nested2 { int z = 30; void multiply() { System.out.println(x*y*z); } } } } class Call { public static void main(String[] args) { Outer i = new Outer(); Outer.Nested j = i.new Nested(); Outer.Nested.Nested2 k = j.new Nested2(); k.multiply(); } }