Java Objective Questions for written test exams 1

Question 1

What will be the result of an attempt to compile and run the following program?
class Box
{
int b,w;
void Box(int b,int w)
{
this.b = b;
this.w = w;
}
}
public class MyBox extends Box
{
MyBox()
{
super(10,15);
System.out.println(b + \",\" + w);
}
static public void main(String args[])
{
MyBox box = new MyBox();



}
}
Choices:
• A. Does not compile; main method is not declared correctly
• B. Prints 10,15
• C. Prints 0,0
• D. None of the above


  







Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---