Skip to main content

Posts

Introduction angular2

Recent posts

Abstract Factory pattern in java

        In Abstract Factory pattern an interface is responsible for creating a factory of related objects without explicitly specifying their classes. Each generated factory can give the objects as per the Factory pattern.  Abstract Factory  is Factory within factory. Its  come under creational Design Pattern in java Example: Step à 1.create interface Shape.java  Public interface Shape { Public void drawshape(); }   Color.java Public interface Color { Public void setcolor();  } Step à 2.implments shape Rectangle.java Public  Class  Rectangle implements  Shape { void drawshape() { System.out.println(“Rectangle drwn”); } } Circle.jva Public  Class  Circle implements  Shape { void drawshape() { System.out.println(“Circle  drwn”); } } Step.3 à implements color Interface Red.java Public class Red implements Color {  ...

Simple factory Design pattern

: If object creation code is spread in whole application, and if you need to change the process of object creation then you need to go in each and every place to make necessary changes. è creates objects without exposing the instantiation logic to the client è refers to the newly created object through a common interface Exapmle:      Step1.-->             Create interface:           Shape.java           Interface Shap{                   public void drowshape();                           } Step2.-->    Implment interface with Class        Create ...

Backup & Restore Database

MySQL database backup/restore with Java Program ? Hi! This article is about creating a java program to backup/restore a MySQL database. The article is in two basic parts, namely Backup  & Restore . 1. Backup - Basically, the MYSQL command to backup database looks like follows. 1 mysqldump -u [username] -p[ password ] -B [dbname] -r [MYSQL file Path] The following Code is for the java program. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 public class Main{       public void restoreDB(String path){        String executeCmd = "C:/xampp/mysql/bin/mysqldump -u xyz -pxxyyzz -B myDB -r " + path;        System.out.println(executeCmd);        Process runtimeProcess;        try...

Webinar:

Webinar: What's New in Java 8 In our 2014 Developer Survey Report , we learned that Java is still the leading programming language, with 49% of developers surveyed wanting training on Java in the next three to 15 months. Oracle recently released Java 8, calling it “a major feature release”. Due to the changes incorporated in Java 8, we thought it would be helpful to offer a webinar discussing the features of Java 8 and how the changes will affect your day-to-day programming. In partnership with AMD, we’re excited to offer our What’s New in Java 8 webinar on Wednesday, August 20, 2014 at 10:00am MDT. Register here for the webinar presented by our instructor, Marnie Knue. Marnie will discuss changes in features such as Lambda Expressions, Java Date-Time Packages, and IO and NIO.

Method Overriding in Java

Method Overriding in Java                  If subclass (child class) has the same method as declared in the parent class, it is known as method overriding .In other words, If subclass provides the specific implementation of the method that has been provided by one of its parent class, it is known as Method Overriding. Advantage of Java Method Overriding Method Overriding is used to provide specific implementation of a method that is already provided by its super class. Method Overriding is used for Runtime Polymorphism Rules for Method Overriding method must have same name as in the parent class method must have same parameter as in the parent class. must be IS-A relationship (inheritance). Understanding the problem without method overriding Let's understand the problem that we may face in the program if we don't use method overriding.    class  Vehicle{  ...