What Is The Output Of The Following Codep Pre Langcpp #248
What is the output of the following code?</p> <pre><code class="language-cpp"> package pack1; class A { public A() { System.out.print(“object created”); } } package pack2; import pack1.*; class B { A a=new A(); } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs111 OOP Object Oriented Programming Java. It can also be found in gs gs111 OOps Access Specifiers - OOPs MCQ: Public Access Specifier - Quiz No.1.
What is the output of the following code?
package pack1; class A { public A() { System.out.print(“object created”); } } package pack2; import pack1.*; class B { A a=new A(); }
Output is: object created
Output is: object createdobject created
Compile time error
Run time error