Aniruddha Mukhopadhyay

Ranch Hand
+ Follow
since Nov 15, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Aniruddha Mukhopadhyay

When you need to compile a SQL stored procedure, Statement would be used.
Thread is NOT started after it is dead!

Output I got was:

C:\Aniruddha\Test>java TestClass6
one : true
one Running
one Running
one Running
one Running
one Running
one : false
Exception in thread "main" java.lang.IllegalThreadStateException
at java.lang.Thread.start(Unknown Source)
at TestClass6.main(TestClass6.java:18)

j1.start() is called twice in the program - the first one prints out "one Running" five times and that's when we get one: true output.

On second attempt at starting j1 (line 18), it throws IllegalThreadStateException.
Oracle Application Development Framework uses Struts for the Controller layer, so there may not be any conflict ....
If you have MS Office in your machine, you can create table in Access for your study.
18 years ago
Servlet container shutting down definitely calls the destroy method of servlet. If servlet container needs some free memory, it would call destroy method for those servlets whose service method have exited or after a timeout period has passed.
18 years ago
Cocoon (http://cocoon.apache.org/index.html)is another good framework to use in specific cases where clients may be using various devices to access a common server.

Of course, there are other XML / XSL based frameworks which does provide the same functionality.
Factory Pattern:
----------------

A Factory pattern is one that returns an instance of one of several possible classes depending on the data provided to it.
Usually all of the classes it returns have a common parent class and common
methods, but each of them performs a task differently and is optimized for
different kinds of data.

There are several similar variations on the factory pattern:

1. The base class is abstract and the pattern must return a complete working
class.
2. The base class contains default methods and is only subclassed for cases
where the default methods are insufficient.
3. Parameters are passed to the factory telling it which of several class types to return. In this case the classes may share the same method names but may do something quite different.

Abstract Factory Pattern:
-------------------------

The Abstract Factory pattern is one level of abstraction higher than
the factory pattern. You can use this pattern when you want to return one of
several related classes of objects, each of which can return several different objects on request. In other words, the Abstract Factory is a factory object that returns one of several factories.

James Cooper's book is a good one on Design Patterns with examples in Java:

http://www.patterndepot.com/put/8/JavaPatterns.htm
Srikanth,

There are 2 stages:

First, the class definition is loaded and all the primitives in this object are set to their default values and the object handles are set to null. If there are any static blocks

Second, the instance variables are initialized in textual order.

In your sample code, statement private int i = giveMeJ() is calling method before value of j has been initialized so it is getting default value zero. If you make j a static variable ("static private int j = 10;"), then output would be 10.

But when you change it to "private int i = j;" , it won't compile,
If all names are unique, you can use HashMap to store the objects:

method put(K key, V value) for adding to HashMap and

method get(Object key) for retrieving based on the key (name in this case).
18 years ago
Free floating synchronized block needs to synchronize on some object. This would compile:

class test20 {

public static void main(String[] args) {
new test20();
synchronized (new Integer(1)) {System.out.println("Synchronized");}
}
}
If you wants objects to be names based on what you get from database, then post above gives exactly what you need.

If you need to have different types (i.e. class) of objects based on what you get from database then one option may be:

class ObjectCreation {

public static void main(String[] args) throws ClassNotFoundException{

Class c = null;

System.out.println("args[0] is " +args[0]);

if (args[0].equals("1")){

c = Class.forName("java.lang.String");}

if (args[0].equals("2")){

c = Class.forName("java.lang.Integer");}

System.out.println("class is " +c.getName());

}
}
18 years ago
Whenever declaration inside a loop is something like:

final int s = a[i];

This creates a new variable so you are not chaging the value, but assigning value to a new variable.

This will compile and work:

class test19 {

public static void main(String[] args) {
int a[]={1,2,3};

for (int i=0; i<a.length;i++){

final int s = a[i]; // this will compile as it is a new variable

System.out.println(s);
}
}
}

This won't compile:

class test19 {

final static int s;

public static void main(String[] args) {
int a[]={1,2,3};

for (int i=0; i<a.length;i++){

s = a[i]; // won't compile, error: "cannot assign a value to final variable s"
System.out.println(s);
}
}
}

Hope it clarifies.
[ September 08, 2005: Message edited by: aniruddha mukhopadhyay ]
I feel a country is "Democratic" if the government is in some way elected by vote of people of the country.
Free speech, Laws which are "fair" etc all help, but cannot be essential conditions for a country to be called Democratic. So USA is a democratic country. As also UK, India, Australia etc. For UK and Australia part of the government is hereditary / nominee of hereditary (from another country!) - but power resides with the elected representatives so definitely "democratic" country.
Only other condition which can be put is that elections are "fair" - not 99.9% vote for a certain president!
My definition of "democracy" - would like know what others feel.
20 years ago
One minor event (in the opinion of editor?) in USA not mentioned?
But this is unbelievable!! May be the date is not correct?
21 years ago