Menu
Question Index
...

What will be the output of the following program? Assume that we run LittleFlowerSchool class.

package com.mc.details;

import com.mc.Stud1.Student;
import com.mc.Stud2.StudentDetails;

public class LittleFlowerSchool {
    public static void main(String[] args) {
        Student std = new Student();
        System.out.println("Rank is " + std.rank);
        System.out.println("Marks is " + std.marks);
        System.out.println(StudentDetails.address);
    }
}
package com.mc.Stud1;

public class Student {
    public int rank = 10;
    public double marks = 89;
    public static void main(String[] args) {
        System.out.println(new Student().rank);
        System.out.println(new Student().marks);
    }
}
package com.mc.Stud2;

public class StudentDetails {
    public static String address = "Hyderabad, Andhra Pradesh, India";
    public static void main(String[] args) {
        System.out.println(address);
    }
}


Rank is 10
Marks is 89.0
10
89.0
Hyderabad, Andhra Pradesh, India
Hyderabad, Andhra Pradesh, India
Rank is 10
10
Marks is 89.0
89.0
Hyderabad, Andhra Pradesh, India
Hyderabad, Andhra Pradesh, India
Rank is 10
Marks is 89.0
Hyderabad, Andhra Pradesh, India
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java Package

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App