MCQs > IT & Programming > Java > Which statement is true about the given code? public class Test78 { public static void main(String[] args) throws Exception { new JBean().setHeight(1).setWidth(2).setDepth(3).setDensity(9); } } class JBean { private int height, width, depth, density; public JBean setHeight (int h) { this.height = h; return this; } public JBean setWidth (int w) { this.width = w; return this; } public JBean setDepth (int d) { this.depth = d; return this; } public JBean setDensity (int d) { this.density = d; return this; } }

Java MCQs

Which statement is true about the given code? public class Test78 { public static void main(String[] args) throws Exception { new JBean().setHeight(1).setWidth(2).setDepth(3).setDensity(9); } } class JBean { private int height, width, depth, density; public JBean setHeight (int h) { this.height = h; return this; } public JBean setWidth (int w) { this.width = w; return this; } public JBean setDepth (int d) { this.depth = d; return this; } public JBean setDensity (int d) { this.density = d; return this; } }

Answer

Correct Answer:

The code compiles and runs.


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

More Java MCQ Questions

search

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it