Category Archives: Design Pattern

Simple class in Python

”’ Created on Dec 30, 2016 @author: asharda ”’ class Class: studentcount=0 def __init__(self,name,salary): self.name=name self.salary=salary Class.studentcount+=1 def displayCount(self): print(“Count seen is “,self.studentcount) c1=Class(“Ashish”,100000) c2=Class(“Ajay”,2000) c2.displayCount()

Posted in Design Pattern, Python, Uncategorized | Leave a comment

Singleton Design Pattern Java

package tests; import org.testng.annotations.Test; class Singleton { private static Singleton object=new Singleton(); private Singleton() { } public static Singleton getInstance() { return object; } public void showMessage() { System.out.println(“This is singleton class”); } } public class SingletonTest { @Test public … Continue reading

Posted in Design Pattern, Java | Leave a comment