Posts

Showing posts from December, 2013

Importing Java Library

Normally novice programmers import Java Library Files using wildcard operator. For example, if someone wants to use files import all Library Files of Java's IO as, "import java.io.*". It creates pressure on compiler for loading all the library files. It is always suggested to import only the specific library file which is going to be used. Now, this can be used in two way, by using import keyword or by using the whole library location each time. As an example, if I want to use the Buffered Reader as a stream reader I can use as 1. import java.io.BufferedReader; 2. in the program not as a header, as java.io.BufferedReader File = new java.io.BufferedReader(...) So, in these two ways a Library File can be used. I think if first method is used the compiler just need to import the file for the whole running time, but if the second method is used compiler needs to import the library each and every time the program uses the library file. That creates extra load on compiler.

Prime Factorization : SPOJ Problem

/*  * To change this template, choose Tools | Templates  * and open the template in the editor.  */ package prime; /**  *  * @author Tamanna Afroze  */ import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.util.StringTokenizer; public class Prime {     /**      * @param args the command line arguments      */     boolean haveFactor(int iNumber){         int iFactors[] = new int[10000];         int iIndex = 0;         iFactors[iIndex] = 1;         iIndex++;         iFactors[iIndex] = iNumber;         iIndex++;          ...