Menu
Question Index
...

What will be the output of the following program?

public class Cricketer {

    String name = "Sachin";
    int score = 100;
    float avg = 50.5f;

    public static void main(String args[]) {
        Cricketer sachin = new Cricketer();
        Cricketer dravid;
        dravid = sachin;
        System.out.println(dravid.avg);
    }
}


50.5
50
Compilation Error
Runtime Error

Doubts

Problems

Topic: Member Variable In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App