Menu
Question Index
...

Write the content of the constructor whose parameter names are same as the member variables name.



class ClassConstructorOperations
{
    public static void main(String s[])
    {
        Student student = new Student( "Lavanya", 501, 95.6 );
        System.out.println(student.rollNumber + " is the roll number of " + student.name + " and she secured " + student.percentage + " % in SSC" );
            

    }



}
class Student
{
    String name;
    int rollNumber;
    double percentage;
}

Doubts

Problems

Topic: this Keyword 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