Multiple choice technology programming languages

What is the output of the following code in Test class Class Myclass Dim Num as Integer Private Sub New (i as integer) Num=i End sub End class Class Test Sub Main() Dim c as Myclass C=New Myclass (10) End sub End Class

  1. Num variable of Myclass is initialized to 10

  2. Run Time Error

  3. Compiler Error

  4. StackOverflow Exception

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The constructor in MyClass is declared as Private, which means it cannot be accessed from outside the class. When Test.Main tries to create an instance with 'C=New Myclass(10)', the compiler detects this accessibility violation and fails before runtime.