{"conversations": [{"from": "user", "value": "Pots donar-me un exemple del patr\u00f3 de disseny Factory en el llenguatge de programaci\u00f3 Java?"}, {"from": "assistant", "value": "interface Shape { void draw (); } class Rectangle implementaments Shape { @ Override public void draw () { System. out. println (\"Rectangle::draw (); } } class Square implements Shape { @ Override public void draw () { System. out. println (\"Square:draw (); } classs Circle implements Shape { @ Override public void draw () { System. out. angl\u00e8s (\"Circle::draw () () } class ShapeFactory { / / / use getShape metod to get obsject of thape publice get. cturlt) resturShape (Shape) {Cpe) iCpe) ifse)"}]}