Posts by "JBT"

Variable shadowing

Today we’ll look into a rare feature of Java: variable shadowing First, let’s define what is a shadowed field or method: A field is considered shadowed when a subclass of its declaring class declares a field with the same name a variable having the same name and type is declared in the local scope a… Continue reading

Create Excel file in java using PoI

package com.howto; import java.io.File; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; /* * Here we will learn how to create Excel file and header for the same. */ public class CreateExcelFile { int rownum = 0; HSSFSheet firstSheet; Collection<File> files; HSSFWorkbook workbook; File exactFile;… Continue reading

Read doc file in java using poi

package com.howto; import java.io.FileInputStream; import java.io.IOException; import org.apache.poi.hwpf.HWPFDocument; /* * Here we will learn how to read a Doc file */ public class ReadDocFile { public static void main(String args[]) throws IOException { /* * Create input stream of the doc file – Provide exact path of the doc * file to read */ FileInputStream… Continue reading

Spring IoC tutorial

What is IoC (Inversion of Control) IoC is a process to define the dependency on Other Object(Objects they will work with). In the normal scenario, we first inject the dependency and then create the bean(Using New keyword) but in this case, we will first create the bean and then inject the dependencies hence it is… Continue reading

Spring Bean tutorial

Spring IoC container manages beans. Container create or configure these beans through configuration metadata provided by any of 3 ways(XML, Annotation, Java based). These beans are represented as BeanDefinition Object inside container. This BeanDefinition object contains several metadata information on how bean should be created. When ever container get a request to create an Object(Named… Continue reading