sivadasan


{ City } chennai
< Country > india
* Profession * software engineer
User No # 38706
Total Questions Posted # 10
Total Answers Posted # 25

Total Answers Posted for My Questions # 17
Total Views for My Questions # 89801

Users Marked my Answers as Correct # 173
Users Marked my Answers as Wrong # 70
Questions / { sivadasan }
Questions Answers Category Views Company eMail

I have 100 records in a table with two rows. I need to display 10 records per page like Google Search. I need only the Logic(Pagination) in Pure Java. No JSP and all..Thanks in Advance...

Cybernet,

2 Core Java 6994

What is Log4j in Jboss ? What is the main use of it?

CTS,

Servers AllOther 1909

Which DB using by Visulal Source Safe ? Can we assign our won database to VSS? or it have any default DB ?

Hexaware,

VSS 1851

I need some details about an employee. i have only the employee id in my presentation layer(JSP).I entered that ID and click "Show Details" Button. Question is how the JSP pass that id to Controller layer and DAO and what mechanism we are using to retrive data from DB and how the data passed to JSP as a Output. Please explain in detail.

TCS,

1 Core Java 4535

My application URL : http://localhost:8080/Application/Login.jsp. When a user enter this url in IE then, how it get Login.JSP Page exactly? what are the processes will happen from when we submit the URL to get Login.jsp?

IBM, TCS,

3 Core Java 42241

What is Three tier architecture. Can anyone explain with a Ordinary web application Project? (JSP,Servlets,JAVA,DAO) ?

TCS,

3 Core Java 10867

We can write any Java Logics in our JSP. Then why we are using servlets(Controller Layer) to interact with the DAO ?

TCS,

6 Core Java 9380

Give me some example for getting connection from connection pooling in JBoss Server. Is Connection Pool default in Server or we have to create it? Who can create Connection Pool in a Team. How it will be accessed by the developer code?

TCS,

1 JDBC 4003

What will happen when ResultSet is not closed?

CTS,

1 JDBC 6243

How many objectname will be created for a single table drop function? Why 'flashback' query giving error "ORA-38312: original name is used by an existing object" while getting the table?

Oracle General 1778




Answers / { sivadasan }

Question { Infosys, 74216 }

What is garbage collection in Java, and how can it be used ?


Answer

Garbage collection is a thread, that runs to reclaim the
memory by destroying objects which object is cannot be
referenced anymore.

Deleting Dynamically created objects from the memory.

Finalize method used to achieve garbage collection.

By using Runtime.gc() or System.gc() the object will be
garbage collected.

Is This Answer Correct ?    30 Yes 14 No

Question { 23042 }

What are Encapsulation, Polymorphism and Inheritance?


Answer

I. Encapsulation - Hiding the implementation details of a
Class. Once a class is Encapsulated then we Cannot directly
access that class members. We can achieve encapsulation
like the following,

Eg: public class {
private ;
private ;
}

In the above example members of the public class declared
as private. So any other class members cannot directly
access the members of that class, and those are stored as a
Single Unit. That is Encapsilation.

Real Time Example - Medical Capsule (Different medicines
packed as in single Capsule)


II. Polymorphism - Ability to process an Object differently
depending upon thier Data Type or Class.

In simple words, One function - different implementations.

There two types of Polymorphism :

1) Compile time Polymorphism - The compiler know that the
way of execution of the program , means - which method
have to be invoked at compilation time. It is achieved by

Method Overloading - Same method name, may be different
parameters, may be different data type, may be different
return type. Method Overloading perform only inside of the
class.

2) Run-Time Polymorphism - The compiler doesn't know the
way of execution of the program. It will take the decision
for execute the program at Run-Time. It is achieved by

Method Overriding - Same Method name, same signatures,
similar DataType, Return type also should be the same.
Method Overriding perform at Subclass.

Real time Example - A man perform multiple role.
He is Employee of his office,He is father of his Childrens,
He is Husband of his wife, He is Son of his Parents.

Inheritance - A class of object can inherit the properties
and methods of an another class of object. Advantage :
reusabilty of code and accessibilty of properties and
methods of derived class by subclass.

Real Time example - Father - Son Relationship.


I hope you will get idea about all those things.

If any issue let me know imm'tly.

Regards,

S.Sivadasan
Coromandel Infotech India Ltd.,
sivadasan.s@c2il.com

Chennai.

Is This Answer Correct ?    46 Yes 3 No


Question { Oracle, 36128 }

what is meant by string pooling?


Answer

See,

String s = new String("Shiva");

Its creating two instances and one reference.

In the Two instance one is stored in Constant pool and
another one is stored in temp' pool.

What about String s = "Shiva";

Anybody can, pls clarify...

Is This Answer Correct ?    4 Yes 3 No

Question { Flextronics, 15779 }

String is an immutable object.
Then how can the following code be justified.

String s1 = ?ABC?;
String s1 = s1+?XYZ?;
s.o.p(s1);

The output is ABCXYZ, which is the value of s1 ?


Answer

It will Give Compile time Error...

We can not declare again s1.

So the Compiler will give

s1 is already defined in main(java.lang.String[])

Is This Answer Correct ?    6 Yes 0 No

Question { CTS, 36268 }

Why we need to serialize the object


Answer

Serialization is a process of writing the state of an
object to the byte stream and also its used to store the
state of an Object (such as a file or memory buffer). Its
for security purpose to send an object on the network.

Is This Answer Correct ?    8 Yes 1 No

Question { TCS, 21127 }

write a query to delete similar records in same table


Answer

I think simply we can do like the following..

1. First we have to transfer all data from a table to
temporary table

create table Temp_table as select * from original_table;

2. Delete all record from Original Table....

delete original_table;

3. Now we can write a query by using INSERT and UNION

If any issue let me know....

insert into original_table (select * from temp_table
UNION select * from UNION )

Is This Answer Correct ?    0 Yes 3 No

Question { TCS, 21127 }

write a query to delete similar records in same table


Answer

Sorry for the previous answer....

We can do like this ,

1. First we have to transfer all data from original_table
table to a temporary table .

create table Temp_table as select * from original_table;

2. Delete all record from Original Table....

delete original_table;

3. Now we can write a query by using INSERT and UNION

insert into original_table (select * from temp_table
UNION select * from temp_table);

any issues let me know.....

Is This Answer Correct ?    1 Yes 0 No

Question { Patni, 22629 }

its a ActionForm controller or model?


Answer

ActionForm is consider as Controller,Because

While ActionForm beans often have properties that
correspond to properties in your Model beans, the form
beans themselves should be considered a Controller
component. As such, they are able to transfer data between
the Model and View layers.

I hope it will helpful

Is This Answer Correct ?    3 Yes 0 No

Question { TCS, 10955 }

class A
{
class B
{
psvm(String args[])
{
}
}
}
if the prg saved in A.java whats the o/p?


Answer

The above code will be compiled succcessfully.

but at runtime it will throw an exception :

Exception in thread "main" java.lang.NoSuchMethodError: main

Because, Java Environment starts its execution from main
method. That method must be declared in the class which is
we are using to save our code.

If any query let me know....

Is This Answer Correct ?    2 Yes 6 No

Question { Honeywell, 6606 }

Hi Friends..


can any one provide the real time example for
methodoverloading and methodoverriding .........


Answer

Hi Here is the Example for Method Overloading:

class A{
  public void fun1(int x){
    System.out.println("The value of class A is : " + x);
  }
  public void fun1(int x,int y){
    System.out.println("The value of class B is : " + x + "
and " + y);
  }
}
public class polyone{
  public static void main(String[] args){
    A obj=new A();
// Here compiler decides that fun1(int)
is to be called and "int" will be printed.
    obj.fun1(2);   
// Here compiler decides that fun1(int,int)
is to be called and "int and int" will be printed. 
      obj.fun1(2,3);       
  }
}


And Method Overriding:

class A{
  public void fun1(int x){
     System.out.println("int in Class A is : "+ x);
  }
}

class B extends A{
  public void fun1(int x){
     System.out.println("int in Class B is : "+ x);
  }
}

public class polytwo{
  public static void main(String[] args){
     A obj;
     
     obj= new A(); // line 1
     obj.fun1(2);  // line 2 (prints "int in Class A is :
2")
     
     obj=new B();  // line 3
     obj.fun1(5);  // line 4 (prints ""int in Class B is :
5")


I think these are very very basic program example for
Method Overloading and Overriding...

Is This Answer Correct ?    3 Yes 1 No

Question { 9134 }

ORA-38312: original name is used by an existing object


Answer

I faced this kind of error while Undrop a table from
recyclebin.

If i droped a table means in recyclebin it will get a new
name in the prefix with 'BIN$'.not only one. there are two
or more object name will be created.

At the time of "flashback" process Oracle is throwing this
error " ORA-38312: original name is used by an existing
object" .

If anybody know the reason pls explain

Is This Answer Correct ?    1 Yes 0 No

Question { INDUS, 8875 }

what are the disadvantages of MVC architecture


Answer

The disadvantage of Struts is , it doesn't have backward
flow.

For example if you are in page-1 and if you want to go to
page-2 then have to call the Action Maping Object of Page-
2. At that time lot of parameters stores in your session.
In case if you want to go back to Page-1 then have to call
Action Mapping object of the Page-1. So now the parameters
will not get reverse.

To avoid this a new framework adde with Struts , that is
WFNM(Web Flow Naviagtion Manager).

I hope it will helpful

Is This Answer Correct ?    4 Yes 2 No

Question { Satyam, 7337 }

how session will be expired ?


Answer

Correct DSR.

I would like to add one more point.

If we declare the session time out in XML means it will
take in minutes to kill the session.

But , if we declared session.timeout(60) in our program
means it will take in seconds. I think.

If any issue let me know

Thanks,

S.Sivadasan
Coromandel Infotech India Ltd.,
sivadasan.s@c2il.com

Is This Answer Correct ?    2 Yes 0 No

Question { CTS, 13150 }

what is Hashmap & Hashtable wirh example?


Answer

Hashmap is not Synchronized where as Hashtable is
Synchronized.

Hashmap allows null values as keys.
Hashtable doesn't allows null values as keys.

Is This Answer Correct ?    3 Yes 6 No

Question { 30744 }

How to convert string containing decimal point into integer
in java? For example given a string like "3.14" as input how
to get integer 3 as result.


Answer

Simple ..

String str="3.14";
int i = Double.valueOf(str).intValue();

// we can use Float instead of Double

Output = 3.

Is This Answer Correct ?    8 Yes 0 No

 [1]   2    Next