gs gs111 Types of Classes (Using Java) - Inner 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 MainClass { int x = 15; class NestedClass { int y = 15; } } class InnerClass { public static void main(String[] args) { MainClass obj1 = new MainClass(); MainClass.NestedClass obj2 = obj1.new NestedClass(); System.out.println(obj2.y + obj1.x); } }
class Outer { int x = 15; private class Nested { int y = 15; } } class Nested { public static void main(String[] args) { Outer ob1 = new Outer(); Outer.Nested ob2 = ob1.new Nested(); System.out.println(ob2.y + ob1.x); } }
class Outer { int x = 10; class Inner { public int ReturnMethod() { return x; } } } class NestedClass { public static void main(String[] args) { Outer obj1 = new Outer(); Outer.Inner obj2 = obj1.new Inner(); System.out.println(obj2.ReturnMethod()); } }
class Outer { int x = 10; class Inner { public int ReturnMethod() { return x; } } } class MainCall { public static void main(String[] args) { Outer obj1 = new Outer(); Outer.Inner obj2 = obj1.new Inner(); System.out.println(obj1.ReturnMethod()); } }
class MainClass { int x = 15; class NestedClass { int y = 15; void print() { System.out.println(x+y); } } } class Sum { public static void main(String[] args) { MainClass obj1 = new MainClass(); MainClass.NestedClass obj2 = obj1.new NestedClass(); obj2.print(); } }
class Outer { int x = 15; class Inner { int y = 15; int print() { return(x+y); } } } class SumReturn { public static void main(String[] args) { Outer obj1 = new Outer(); Outer.Inner obj2 = obj1.new Inner(); System.out.println(obj1.print()); } }