Menu
Topics Index
...
`

Print Issue status


If you need explanation Read this topic

If you need Answer Take test on this topic

Print Issue status
What will be the output of the following program?
public class IssueRises {
    public String myIssue = "Issue not fixed";
    public void IssueRises() {
        myIssue = "Issue is Fixed";
    }
    public static void main(String[] args) {
        IssueRises ir = new IssueRises();
        System.out.println(ir.myIssue);
    }
}

A. Issue not fixed
B. Issue fixed
C. Some other output
D. Compilation Error or Runtime Error
Topic: Static and Non Static Variables - Static and Non Static Methods

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Answer C
As it prints "Issue is Fixed" not Issue fixed :)

Posted by Jayachandra Gupta    2013-12-13 03:47:57


Ans is A.. here we r nt calling the method IssueRises so myIssue variable doesnt changes..

Posted by Om Prakash Om    2013-12-13 03:50:38


Yeah gud one i didn't notice void Om Prakash...

Posted by Jayachandra Gupta    2013-12-13 03:52:41


ans is A,becoz constructors dont have a return type(even void),so constructor does not invoked

Posted by Raviteja Daggupati    2013-12-13 03:53:53


Answer is A,
There is no constructor, its method and ir object points to myIssue String so "Issue not fixed" will be printed.

Posted by Amar Kumar Biradar    2013-12-13 04:32:19


Congratulations Raviteja Daggupati. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2013-12-16 03:19:51


thanks Merit Campus

Posted by Raviteja Daggupati    2013-12-16 04:04:00


© meritcampus 2019

All Rights Reserved.

Open In App