Home / CSE / Javascript - CS :: Discussion

Discussion :: Javascript - CS

  1. Which is a more formal way of importing packages and classes as JavaScript objects?

  2. A.

     import(java.util.*);

    B.

     importClass(java.util.*);

    C.

     import.Class(java.util.*);

    D.

     Class.import(java.util.*);

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    Because packages and classes are represented as JavaScript objects, you can assign themto variables to give them shorter names. But you can also more formally import them, if you want to:

    importClass(java.util.HashMap); // Same as : var HashMap = java.util.HashMap


Be The First To Comment