What is the output of the following codeClass _Myclass Public Shared Num as integer Public Sub New (I as integer) {num=i} End sub Public sub New() End sub End Class Class Test Dim Cls1 as _Myclass (100 ) Dim Cls2 as New _MyclassConsole.Writeline (Cls2.num)End Class

A) Prints 0
B) Prints 100
C) Prints Null
Explanation: prints 100 because num is shared variable

Showing Answers 1 - 1 of 1 Answers

As I have gone through this code, might return compiler error. Because we cannot decalare variable with initializing with 'New' key word. But in this code the

'Dim Cls1 as _Myclass (100 )' does not have 'New' key word.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions