Pages

Wednesday 30 October 2013

Difference between BeanFactory and ApplicationContext container

BeanFactory : 
  • BeanFactory is an interface which has one concrete cubclass called XmlBeanFactory.
    Following is the way to create BeanFactory container instance
    BeanFactory bf=new XmlBeanFactory(res);
    Resources may be of type ClasspathResource or FileSystemResources.
  • BeanFactory will be loaded lazily by default.
  • BeanFactory container does not support annotation.
  • BeanFactory does not support BeanPostProcessor.
  • BeanFactory does not support Event publishing.
  • BeanFactory does not provide a way to resolve message bundle.
ApplicationContext : 
  • ApplicationContext is an interface which has 3 concrete subclass called
    ClasspathXmlApplicationContext
    FileSystemXmlApplicationContext
    XmlWebApplicationContext
  • BeanFactory configured with ApplicationContext container will be loaded aggressively by default.
  • ApplicationContext container do support annotation.
  • ApplicationContext container do support BeanPostProcessor.
  • Application context do provide a way to resolve message bundle.

Tuesday 29 October 2013

Difference between DTD and SCHEMA

DTD :
  • DTD support only two data type called PCDATA and CDATA.
  • DTD does not alow to describe custom datatype.
  • DTD does not support XML namingspace.
  • DTD document may not be an XML document.
  • DTD's may be internal or external.
  • You can include one DTD in xml document.
SCHEMA :
  • SCHEMA support built in data type as int, long, float, doubble, String, Date etc.
  • SCHEMA allow you to describe custom datatype.
  • SCHEMA must support XML namingspace.
  • SCHEMA document must be an XML document.
  • SCHEMA must be external always.
  • You can include multiple XSD's in xml document.

Components of Log4j

There are mainly 3 components to work with Log4j :

  • Logger :
    Logger component is used to access the log statement in java class instead of printing on console.
  • Appender :
    Appender is used to write the log statement in some specific external file, network, database etc.
  • Layout : 
    Layout component is used to specify the format in which you have to write the log message.

Difference between SAX parser and DOM parser ?

SAX Parser :
  • Sax is read only parser.
  • Sax follows event driven model.
  • Using Sax you can read the data sequentially.
  • Sax occupies very less memory because only one element information will be stored in the memory at a time.
DOM Parser :
  • Dom is read write parser.
  • Dom follows tree model.
  • Using Dom you can read the data randomly.
  • Dom occupies more memory because entire object graph and memory will be loaded in main memory at a time.

Saturday 26 October 2013

Difference between compiler and interpreter



Compiler  

Interpreter

1. To compile the programme for which compiler is used.

1. To interpret the programme
for which interpreter is used.
2. Compiler is used to compile whole programme at a time and produce all
the errors after inspecting all the instructions.  

2. Interpreter is used to interpret the
programme line by line and show
immediately if found while interpreting.

3. It check the whole programme once. 

3. It checks the programme line by
line and unless we correct the error occurred in respective line it won't interpret next line.


4. It is much faster.

4. It is slower as compared to compiler.

5. C is compiled language in which compiler is used to compiler the c code.

5. Java is compiled + Interpreted
language in which compiler and interpreter both are used.