sumit pal singh


{ City } hyderabad
< Country > india
* Profession * software developer
User No # 108158
Total Questions Posted # 1
Total Answers Posted # 14

Total Answers Posted for My Questions # 0
Total Views for My Questions # 1324

Users Marked my Answers as Correct # 21
Users Marked my Answers as Wrong # 3
Questions / { sumit pal singh }
Questions Answers Category Views Company eMail

What is the use of implicit object named "application" in Application?

Indriyn Data Labs,

JSP 1324




Answers / { sumit pal singh }

Question { 4515 }

Explain the purposes of methods wait(), notify(), notifyAll
()?


Answer

The purpose of using the wait(),notify() and notifyAll() methd is used for interThread communication.
for Example :-There is a n situation communication between Producer and Consumer...Producer wll produce an item and go to waiting state by using wait() method.and it will notify to the consumer for to consume an item. After conume an Item Consumer will come into waiting state by using wait() method ..and give the notification to Produer by using notify() method to produce an item.But all these methods are called only in synhronized() method or synchronized block.

Is This Answer Correct ?    1 Yes 0 No

Question { Satyam, 53344 }

Difference between application and session ?


Answer

Session object is used to store state specific information per client basis. It is specific to particular user.
Application object is used to store data which available across the entire application and shared across multiple users sessions.

Session has the expiration time,default time 20 mints.But application object doesn't have the expiration time.

Session object is used to maintain the session of each user. If one user enter in to the application then they get seesion id if he leaves from the application then the session id is deleted.If they again enter in to the application they get different session id.
But for application object the id is maintained for whole application.it doesn't differ for any user.

Is This Answer Correct ?    1 Yes 0 No


Question { IBM, 55317 }

what is catalina in tomcat server.


Answer

Catlina is a container that is used to execute sevlet program .it is internally contained by Tomcat Server also.in the form of(Catlina.jar file).

Is This Answer Correct ?    0 Yes 0 No

Question { 11025 }

If you want to modify the servlet,will the Webserver need
to be ShutDown ?


Answer

No,Need to shutdown the Application server/webserver ,only recompile and reload of webapplication is enough after modification in servlet program.this will effected.

Is This Answer Correct ?    0 Yes 0 No

Question { Satyam, 3520 }

what are the top level class of interface in java?


Answer

NO, Default top level class for Interface in java .

Is This Answer Correct ?    0 Yes 0 No

Question { Cap Gemini, 6875 }

can we write implementation for a method with in another
method?


Answer

Yes,we can write one method implementation inside another method.

public class ImplementMethodEx {
public void m1(){
System.out.println("M1-Method Impl.");
}
public void m2()
{
m1();
}
public static void main(String[] args) {
ImplementMethodEx obj=new ImplementMethodEx();
obj.m2();

}

}

Is This Answer Correct ?    0 Yes 0 No

Question { TCS, 4807 }

why we use new keyword for object


Answer

The new Keyword is used to allocate the memory at run time to the Object.Because java Support dynamic Programming language.

Is This Answer Correct ?    0 Yes 0 No

Question { Artech, 16824 }

What is the difference between JspWriter and PrintWriter


Answer

JspWriter class Object is used to print the value in Jsp Page. it is not the object of JspWriter abstarct class it is the object of the class that implements JspWriter i.e. Writer....
PrintWriter class Of java.io package create an objectthatis used in servlet to print the value on console.

Is This Answer Correct ?    0 Yes 0 No

Question { Manhattan, 3827 }

Given: (x-2)(x+3)= 100;

solve the equation for x using any programing language.


Answer

/*Given: (x-2)(x+3)= 104; solve the equation for x using any programing language.*/
package classroom.program;

public class SolveProblem {

public static void main(String[] args) {

for(int x=0;x<100;x++)
{
if((x-2)*(x+3)==100)
{

System.out.println(x);
}
}


}

}

//output::=10

Is This Answer Correct ?    1 Yes 2 No

Question { HCL, 3132 }

What are the other ways to create an object with out calling
new keyword in java?


Answer

1.by using newInstance();,but before this we have to load the class by using Class.forName();

myobject obj=(my object)class.for name("sub in.rnd.my object").new instance();

2.By using clone();
3.BY using DeSerialization.
ObjectInputStream inStream = new ObjectInputStream(anInputStream );
MyObject object = (MyObject) inStream.readObject();

4.By using String class .

Is This Answer Correct ?    0 Yes 0 No

Question { 5922 }

String is mutable or immutable?


Answer

String class is immutable .In String class we can not change or modify object value. To make an object value modifiable. we can use StringBuffer and StringBuilder classes.

Is This Answer Correct ?    7 Yes 0 No

Question { HTC, 6099 }

Write a program to calculate the following
i want a Java program for this condition
1+4+9+16+….+100

Like this (1^2+2^2)

Hint use function pow(a,b)


Answer

public class Power {

public static void main(String[] args) {
int b=2;
for(int i=1;i<=10;i++)
{
System.out.println(Math.pow(i,b));
}


}

}

Is This Answer Correct ?    7 Yes 1 No

Question { HCL, 2617 }

what is the Scope of Final Keyword in Java?


Answer

Final Keyword has limited Scope because it is like a constant keyword.

If we declare a class As "final" then we can not extends this class.so we can not get benifit of inheritance class.

If we declare a method as "final" then we can not override this method.Becoz metgod overriding is not possible with final keyword.

If we declare a variable as "final" then we can not change the value of final varible .because these are the constatnt variable having fixed value if we use "final" keyword with a variable.

Is This Answer Correct ?    1 Yes 0 No

Question { L&T, 5225 }

what is the difference between static class and singleton class? can we create static class?


Answer

Static class always a inner class. and static class can create multiple objects.all object have different reference value.
But on the other hand SingleTon class can have only single object because every object reference variable have same reference value.

Is This Answer Correct ?    3 Yes 0 No