Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c ) Analyse the following pieces of code for class A and class B . These pieces of code violate the design principles.

c) Analyse the following pieces of code for "class A" and "class B". These pieces of code violate the design principles. class A { public String name; public Al){ name="John"; } public void printnamel){ if (name !=null){ System.out.println(name); }} class B { public static void main(){ A ob= new A); ob.name="Mary"; System.out.println(ob.name); }}1. Identity and describe the violation. 2. Make suggestions to resolve the violation. 3. Write the code for better design.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

analyze file formats and basic digital design rules.

Answered: 1 week ago

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago

Question

Question What is the advantage of a voluntary DBO plan?

Answered: 1 week ago

Question

Question How is life insurance used in a DBO plan?

Answered: 1 week ago