gs gs111 Types of Classes (Using Java) - Static 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.
public class getClass { public static class Inner { public void print() { System.out.println("Inner"); } } public static void main(String[] args) { getClass.Inner i = new getClass.Inner(); System.out.println(i.getClass()); i.print(); } }
class getClass$Inner Inner
class getClass.Inner Inner
class Inner Inner
public class StaticOuter { public static class StaticInner { public void display() { System.out.println("StaticInner"); } } public class Inner { public void display() { System.out.println("Inner"); } } public static void main(String[] args) { StaticOuter.StaticInner i = new StaticOuter.StaticInner(); System.out.println(i.getClass()); i.display(); StaticOuter.Inner j = new StaticOuter.Inner(); System.out.println(j.getClass()); j.display(); } }
class StaticOuter$StaticInner StaticInner class StaticOuter$Inner Inner
class StaticOuter.StaticInner StaticInner class StaticOuter.Inner Inner
public class Program { public static class Char { public void print(int a) { System.out.println((char)c); } } public static void main(String[] args) { Program.Inner i = new Program.Inner(); i.print(97); } }
public class DisplayProg { public static class Display { String a; Display(String a) { this.a = a; } public static void display() { System.out.println(a); } } public static void main(String[] args) { DisplayProg.Display i = new DisplayProg.Display("A","A"); i.display(); } }
public class String { public static class obj { String a; int b; obj(String x, int y) { a=x; b=y; } } public static void main(String[] args) { String.obj i = new String.obj("San",10); System.out.println(i); System.out.println(i.toString()); } }
San 10 "San 10"
"San" 10 ""San" 10"
String$obj@2a139a55 "San" 10
String$obj@2a139a55 String$obj@2a139a55
public class StringProgram { public static class Compare { static String a,b; Compare(String x, String y) { a=x; b=y; } public static void compare() { if(a==b) System.out.println("The strings are equal"); else System.out.println("The strings aren't equal"); } } public static void main(String[] args) { String a = new String("NVAEducation"); String b = new String("NVAEducation"); StringProgram.Compare i = new StringProgram.Compare(a, b); i.compare(); } }
public class charAtFunction { public static class Inner { public static void indexChar(String a, int b) { System.out.println(a.charAt(b)); } } public static void main(String[] args) { charAtFunction.Inner.indexChar("NVAEducation", 8); } }