Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Question!


Name: Abhishek
Title:
  what is the output?
Question:
   public class Sample{
       public static void main(String[] args)
    {
        Demo d = new Demo(20);
        System.out.println(d.num);
    }
} class Demo
{
    final int num;
 
    public Demo(int n)
    {
        num = n;
    }
 
}
Answers:

Name: Daniel
I guess you are trying to assign a value to the constant variable value through the class constructor. So the answer would be 20.