MCQs > IT & Programming > Java > What happens on attempting to compile and run the following code? public class Graft { public static void main(String argv[]) { Graft g = new Graft(); } protected Graft() { for(int i =0; i <10; i ++) { System.out.println(i); } } }

Java MCQs

What happens on attempting to compile and run the following code?

 public class Graft
 {
 public static void main(String argv[])
 {
 Graft g = new Graft();
 }
 protected Graft()
{
 for(int i =0; i <10; i ++)
 {
 System.out.println(i);
 }
 }
 }

Answer

Correct Answer: Successful compilation with output 0 to 9

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it