Question: in Java, 1. Use examples to explain the benefits of Encapsulation, Inheritance and Polymorphism 2.Why we need a constructor in a class? If we don't
in Java,
1. Use examples to explain the benefits of Encapsulation, Inheritance and Polymorphism 2.Why we need a constructor in a class? If we don't create it, what will happen? 3.How are indefinite loops used for validating data? Why is a loop structure typically the better choice for validating data than an if statement? 4. while(10 > 1){ System.out.println("This prints forever."); } Identify the problem that exists in the above while loop. 5. Why would a programmer use curly braces in the body of a dowhile loop?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
