How to read a file in Java

Hi there! Welcome back! Today I will talk about the different ways to read a file in Java. For starters there are two classes  you can use to read and write files in Java. There are Java I/O classes and Java NIO Streams. The main difference between these two packages is that the read() and write() methods of Java …

Design Patterns

A design patterns are patterns that explain, motivate and names a general design in the problem solving process in object-oriented programming. https://www.geeksforgeeks.org/software-design-patterns/ There are different classification systems that design patterns fall under creational, behavior and structural . Creational design patterns abstract the instantiation process. They increase independecy of the creation, composition and representation of the …

Structural Designs

Decorator Design Pattern Decorator is a structural design pattern that lets you attach new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors. In the UML diagram below you can see the VisualComponent abstract class for visual objects that defines their drawing and event handling interface. It Implements the TextView …

Creational Design Pattern

Factory Method lets a class defer instantiation to subclasses and we create objects without exposing the creation logic to client and the client use the same common interface to create new type of object. The creator class declares the factory method that must return an object of a product class. The creator’s subclasses usually provide …

Behavior Design Patterns

Strategy Design Pattern: In the strategy design pattern you are defining classes that encapsulate different linebreaking algorithms. Using this strategy you can make algorithms interchangeable and vary independently from the clients who use it. This software design pattern also enables an algorithm’s behavior to be selected at runtime. The Strategy pattern suggests that you take a class …

Injection in SQL

Hi all and welcome back! Today I will go over injection. SQL injection is a code injection technique, used to attack data-driven applications, in which malicious SQLstatements are inserted into an entry field for execution and can destroy your database. Scary huh. So this is why I am going to talk about it in this blog so you can avoid this …

Deep Cloning

Hi all and welcome back! On this blog I will be talking about deep cloning. Cloning is a process of creating an exact copy of an existing object in the memory. In java, clone() method of java.lang.Object class is used for cloning process. Not every object is able to undergo the cloning process. The objects which implement Cloneable interface are the only …

Design a site like this with WordPress.com
Get started