[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

JAVA Programming :: Basic Concepts - Discussion

Home > JAVA Programming > Basic Concepts > MCQs Questions Discussion

18 / 64

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();
        m.amethod();
        }
void amethod(){
        System.out.println(s);
        }
}

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

Hence, output will be null.

Asked In :: Virtusa

Post Your Answer Here:     

Reply    
Rate This: +1 -0 +
    Report


Report Error

Please Login First Click Here