Nov 15

Java Glossary/ Dictionary-Letter C-part 7

Number of View: 20

31) ClassLoaders :

Class loaders in java are used to load classes at runtime.

There are 3 different class loaders in java :

  1. Bootstrap class loader
  2. Extension class loader
  3. System class loader.

32) Class method :

Class methods are also called as static methods.

Static members are used by other classes without creating an instance of the class.

Static methods do not operate on objects.

Methods are declared as static when they perform operations independent of instance variables.

Static method belongs to whole class not to particular instance.

Static method operate only on static data and cannot access non static data such as instance variables.

A static method can call other static method but cannot call non static methods.

A static method cannot refer to super or this keyword.

Example : Math class which contains only static fields and methods.

To call static method use class name followed by dot.

Syntax:ClassName.methodName(argument);

Ex:Math.sqrt(16);

Note : JDK 8 added a new feature static methods can be defined in interface.Just like how we call static methods in class in the same way we call static methods in interface. Continue reading

Nov 15

Java Glossary/ Dictionary-Letter C-part 6

Number of View: 24

26) Cast :

Casting is used to convert one datatype in to another.We can use casting to convert double to int.In casting there is a chance to lose information.

For example : when converting double to int.

 

27) Catch :

Catch block is used to catch the exception.Catch block gets executed whenever an exception is thrown.Each catch block is an exception handler that handles the exception indicated by its argument.

Prior to java 7 catch block can handle only type of exception.From Java 7 a catch block can handle more than one type of exception.

Catch blocks are associated with try blocks.For every try block there should be atleast one catch block or finally block. Continue reading

Nov 08

Servlets Tutorial : Explain about http protocol in detail?

Number of View: 67

Explain http protocol in detail?

1)      HTTP Protocol is an client server tcp based protocol.

2)      Browser or client communicates with web server using http protocol.

3)      Client sends the HTTP request  and sends to the server.

4)      The webserver receives the request and processes the request and generates the response. Continue reading

Nov 08

Servlets Tutorial : Important components of web application?

Number of View: 49

Explain the important components of Webapplication?

1) Browser

2) WebServer

3) DatabaseServer

1) Browser can be either internet explorer,Mozilla or safari.Browser is used to send the request to the server.

2) Webserver is the place where actual webapplication is deployed.Whenever browser sends request it sends it to the webserver.webserver gets the resource requested by client from DBMS or from any other external sources and gives the response back to the client. Continue reading

Nov 02

Servlet Tutorial 9 : Explain Servlet Config interface and its importance in servlets?

Number of View: 1708

Servlet Config:

1) Servlet config is used by servletcontainer to communicate to servlet.After init() method is called by servlet container ,it passes the servlet config object to the servlet.

2) The servletconfig contains information that we can pass to the servlet using deployment descriptor. Continue reading

Nov 02

Servlets Tutorial 8 : Explain differences between Generic Servlet and Http Servlet?

Number of View: 55

Difference between Generic Servlet and HTTP servlet ?

Generic Servlet Http Servlet
1)      Generic Servlet is subclass of Servlet interface. 1)      Http Servlet is subclass of Generic Servlet.
2)      Generic servlets are protocol independent .It can access http,ftp etc 2)      Http Servlets are protocol dependent.It can access only http and https protocol. Continue reading