Method Can Be Used To Access The Servletconfig Object ?
Method Can Be Used To Access The Servletconfig Object ?
Question: Name the containers which uses Border Layout as their default layout?
Answer: Containers which uses Border Layout as their default are: window, Frame
and Dialog classes.
Similarities:
o Scrollable result sets- using new methods in the ResultSet interface allows
programmatically move the to particular row or to a position relative to its
current position
o JDBC 2.0 Core API provides the Batch Updates functionality to the java
applications.
o Java applications can now use the ResultSet.updateXXX methods.
o New data types - interfaces mapping the SQL3 data types
o Custom mapping of user-defined types (UTDs)
o Miscellaneous features, including performance hints, the use of character
streams, full precision for java.math.BigDecimal values, additional security, and
support for time zones in date, time, and timestamp values.
Question: What is OOPS?
Answer: OOP is the common abbreviation for Object-Oriented Programming.
o Method overloading
o Method overriding through inheritance
o Method overriding through the Java interface
o Public
o Protected
o Private
o Defaults
Following table lists the primitive types and the corresponding wrapper classes:
Primitive Wrapper
boolean java.lang.Boolean
byte java.lang.Byte
char java.lang.Character
double java.lang.Double
float java.lang.Float
int java.lang.Integer
long java.lang.Long
short java.lang.Short
void java.lang.Void
Question: What is the difference between the instanceof and getclass, these two
are same or not ?
Answer: instanceof is a operator, not a function while getClass is a method of
java.lang.Object class. Consider a condition where we use
if(o.getClass().getName().equals("java.lang.Math")){ }
This method only checks if the classname we have passed is equal to
java.lang.Math. The class java.lang.Math is loaded by the bootstrap ClassLoader.
This class is an abstract class.This class loader is responsible for loading classes.
Every Class object contains a reference to the ClassLoader that defines. getClass()
method returns the runtime class of an object. It fetches the java instance of the
given fully qualified type name. The code we have written is not necessary,
because we should not compare getClass.getName(). The reason behind it is that if
the two different class loaders load the same class but for the JVM, it will consider
both classes as different classes so, we can't compare their names. It can only
gives the implementing class but can't compare a interface, but instanceof operator
can.
The instanceof operator compares an object to a specified type. We can use it to
test if an object is an instance of a class, an instance of a subclass, or an instance
of a class that implements a particular interface. We should try to use instanceof
operator in place of getClass() method. Remember instanceof opeator and getClass
are not same. Try this example, it will help you to better understand the difference
between the two.
Interface one{
}