adplus-dvertising
frame-decoration

Question

If I already had a Debug class in the main namespace. What will be the output of the following code?
namespace main;
use com\getinstance\util\Debug;
<pre lang="php" cssfile="hk1_style" >
class Debug {
    static function helloWorld() {
        print "hello from main\Debug";
    } 
}
 
Debug::helloWorld();

a.

error

b.

hello from main

c.

hello from main\Debug

d.

debug

Posted under PHP

Answer: (a).error

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. If I already had a Debug class in the main namespace. What will be the output of the following code?

Similar Questions

Discover Related MCQs

Q. Which one of the following statements is true for include_once() and require_once()?

Q. Which one of the following statements is true for require() and require_once()?

Q. Which function was introduced to help automate the inclusion of class files?

Q. How many times can you define __autoload in a process?

Q. Which one of the following functions will you use to check that the class exists before you work with it?

Q. Which one of the following will you use to check the class of an object?

Q. PHP 4 did not support instanceof. Instead, which function did it provide?

Q. You use the get_class_methods() function to return the names of all the methods in the class. Which function will you use to print it on the screen?

Q. If you call a method and it doesn’t exist it’ll cause a problem. To check the method which function will you use?

Q. What will be the output if a protected method is given as argument to the function method_exist()?

Q. Which one of the following function should I use to find the parent class of a class?

Q. Which class accepts a class name or an object reference and returns an array of interface name?

Q. Object-oriented code tries to minimize dependencies by moving responsibility for handling tasks away from ___ and toward the objects in the system.

Q. Placing a static method for generating ___ objects in the ___ class is convenient.

Q. The extent to which proximate procedures are related to one another is known as…

Q. ______ occurs when discrete parts of a system’s code are tightly bound up with one another so that a change in one part necessitates changes in the others.

Q. ________ code makes change easier because the impact of altering an implementation will be localized to the component being altered.

Q. Polymorphism is also known as______

Q. Which one of the following is known as the key to object-oriented programming ?

Q. Which one among the following means tight coupling ?