Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Sdfaskljhvcgabn iyugd qawqw7te777 hwvy tgfyu g uyqsdy v

QHSGC HBN JHGVq yg yhgvuy7 g uyg I

Ahgdvh bb hsbjh jhbask iuah hjbud ljjhgj ujhghbsdujq hyvsBS


YHBVHJb ubduiQ KJBDH IUHGOINH JHUIDU uibhli8lkkbdf
wdbuin hyhjydf bbdub uy qbudbu

Creational
These design patterns are all about class instantiation or object creation.
These patterns can be further categorized into Class-creational patterns
and object-creational patterns. While class-creation patterns use
inheritance effectively in the instantiation process, object-creation
patterns use delegation effectively to get the job done.
example, if the instance variable has already been instantiated, then each
time any client accesses the getInstance() method,
the synchronized method is run and the performance drops. This just
happens in order to check if the instance variables’ value is null. If it
finds that it is, it leaves the method.

1.Code

public class AnswerScriptEvaluator extends AnswerScript{


public int eval(AnswerScript as){
int m =0;
while(as.nextLine()){
if(as.getLines().contains("Design Pattern")||
as.getLines().contains("3 types")||
as.getLines().contains("Creational")){
m++;
}
}
return m;
}
}
package com.mycompany.answerscript;
import java.util.List;
public class AnswerScript {
List<String>lines;
public List<String>getLines(){
return lines;
}
public void setLines(List<String>lines){
this.lines=lines;
}
boolean nextLine() {
return false;
}
}

You might also like