Click To Get Off-Campus Placement Jobs Info !!!
Capgemini Recruitment Process 2020 – Updated Test Pattern and Selection Process in Details Latest Pattern !!
FREE!!! Capgemini Game based Aptitude Test Questions for Practice

Virtusa Written Test Qs.(JAVA Programming) :: Basic Concepts - Discussion

18 / 119

What will happen when you attempt to compile and run the following code?

public class MyField{
String s;
public static void main(String argv[]){
        MyField m = new MyField();
void amethod(){

ACompile time error s has not been initialised

BRuntime error s has not been initialised

CBlank output

DOutput of null

Answer: Option (Login/Signup)

Show Explanation

The above code will compile fine, no problem in that, but the output will be null, since variable 's' has not been initialized with some value.

Hence, output will be null.

Asked In :: Virtusa

Post Your Answer Here:     

Rate This: +0 -0

Report Error

Please Login First Click Here