What is synchronization and what are tools of synchronization ?
Why thread has created in two ways and why not in one way or three ways? Anyone please help me to get the answer
Creating thread is basically instantiate the Thread class. There are two ways to instantiate class: with extend or implementation of interface.
What is command design pattern? Explain this pattern based on below scenario map m=new hashmap(); hashmap m=new hashmap(); what is difference between map m=new hashmap(); hashmap m=new hashmap();
The main difference of creation of hashmp instance
HashMap hm = new HashMap(); Here we are getting the HashMap methods only will get inherited.
Where as
Map mp= new HashMap(); // Here will get the Map interface methods inherited into class.
Can we declare class as protected?
What is the scope for this class?
Answered by: dipl. ing. Dan
View all answers by dipl. ing. Dan
Member Since Mar-2006 | Answered On : Mar 24th, 2006
Some people might get confused by the many posts. The correct answer to the question "can we declare class as protected?" is YES, BUT only as an inner class. A 'normal' class cannot be protected or private.
// 'Normal' class - only default or public allowed
public class ProtectedOrNot {
// Inner class - public, default, protected, private allowed
protected class InnerClass {
}
public static void main(String[] args) {
}
}
Class can be protected or private but only inner
The class cannot be declared as protected..
Why init(), destroy() can't be overridden in servlets?
Can override init & destroy .
People used to make mistakes by overriding inti(ServletConfig).
Because if we override and forget to call super.inti(ServletConfig) then default actions doesnt get performed. As a result getServletConfig() will return null.
It is possible to Override init() & destroy() methods in servelts
Project Architecture is nothing but is structure of your application. What are the layers are used to retrive the data from the Database."java Presentation Layer ----------->Contr...
The architectures is nothing but how many layers will be there and which technologies are involved on each layer. 1) View Layer -------------> JSP, HTML, Ajax Technologies 2) Persistence Layer -----...
What is the exact use of singleton class?Just using priVATe class constructor makes it a singleton class?
Singleton class is used for only one instance is created for entire application. One instance and multiple threads."java class Singleton { private static int singleton; pri...
In software engineering, the singleton pattern is a design pattern that restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions acr...
What are the different acess specifiers?
public:
default:
private:
protected:
there are 4 access specifiers defined in java.private: who can be accessed within class only.default:who can be accessed within the same package.protected: who can be accessed within the same package ...
What is the difference between JSP tag and HTML tag
Both the tags are used to developing the web pages. HTML tags are static. Where as JSP tags are dynamic.
Differences between HTML and JSP : HTML pages provide Static content with emphasis on the appearance, semantics and layout of the Information in the browser. JSP pages consists of dynamically changi...
Java single inhertiance and multiple inheritance
1.What is meant by inheritance,single inhertiance,multiple inheritance?2.Define abstract class & abstract method?3.How to developed and delopying a servelt,JSP program in the tomcat apache server,weblogic server?Plz send the answer for the particular abo
Single Inheritance in Java means that a sub class have the capability of inheriting the properties of only one class whereas multiple inheritance is not supported by Java as it increases the complexit...
Single Inheritance: It is sharing only a particular classes Eg: Agents,Proker,join family ......... Multiple Inheritance: It is also sharing with all classes.access specification ...
Java-class variable vs instance variable
Some body please tell me what is the difference between class variable and instance variable???
Static variable, the field is allocated when the class is created. It belongs to the class and not any object of the class. It is class variable. Instance variable, the field is allocated when the c...
class variable is static variable is create when class structure is defined ,and other variables which are create and destroyed with object are called instance variables
How will you provide security to your j2ee project?
Security roles can be applied at application level by either declarative method or programatically. Users or Groups are binded during application deployment by administrator.
Why is that the final variable has to be initialized as soon as it is declare?
Answered by: r.praveenkumar
View all answers by r.praveenkumar
Member Since Oct-2007 | Answered On : Aug 1st, 2008
when a variable is declared as final we cant change its value again. we use final variable to declare a constant so when we declare a variable as final and if we were allowed to not to give its value at the time of declaration it would not make sense so people who designed java made mandatory to give the value when we declare a final variable. then only it will be sensible.
final PI=3.14;
then we cant change PI's value. think if the above statement do not contain a vl it would not make sense.
final keyword can be applied on:- 1.class 2.member functions(only non-static) 3.data-members(both static and non-static) 4.local variables. 1.by making a class final ,that class cannot be inherited....
Like any variable, a final variable can also be first declared and then assigned a value. But it can be only assigned a value once and only once ( as its final variable ). for example :- final Strin...
Available methods in synchronization ?
Synchronization is a process by using Synchronize keyword to prevent the dead lock. This can be used in methods or block to prevent two threads to access the same resource in the same time.
In this two threads cannot use the same resource simultaneously beacuse the thread execution gets interrupted or terminated hence only a single thread can share resource at a time.
What is cloning? Why we are using cloning concept? And how many types of cloning?
Cloning is the process of creating duplicate copy with current object state. We use this concept in real world like, eg: In Bike manufacturing company, we use cloning for creating same bike object,...
In Java, Cloning is kind of logic to create a copy of the class by implementing Clonable interface.
Why pointer concept not use in Java?
Java does not support pointer or cannot allow pointers because doing so would allow java programs to breach the firewall between the java execution environment and the host computer
java does not support pointer because of security purpose, as if it have pointer then till easy to find out the addressing of its application which may make it unsecure
How many thread priority levels levels are there in Java 3810 1224
The priority of thread can be max,norm and min depending on the underlying os or JMV.
The thread priority levels in terms of integer range from 1 to 10
For max, min & medium priority we have the following:
MAX_PRIORITY (value=10)
NORM_PRIORITY (value=5)
MIN_PRIORITY (value=0)
File extension .xba is a Unknown or unassigned file extension.
Let me tell you where exactly it is used and what it does as per my knowledge.Application library used by OpenOffice.org, an open-source productivity suite; contains the functionality for the componen...
Why Java soft has declared httpservlet class as an abstract class?Is there any performance issue?
In httpservlet class there is no any abstract method although Javasoft declared this class as an abstract class.Ok,this is valid in Java.So if we want to utilize this class we will have to extends this class.But we can use to achieve this one by using httpservlet class as simple Java class also.
Java soft has declared httpservlet class as an abstract class for its performance, scalability and reusability issues and for security purpose.
Security Purpose
Can we use a servlet as the shared object
We can use servlet as a shared object by using as shared object the servlet can maintain its state by using its init() and destroy() methods to load and save its state.
Java Patterns Interview Questions
Synchronization is the process of allowing threads to execute one after another. Synchronization control the access the multiple threads to a shared resources. Without synchronization of threads, one ...