ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories >> Software >> Java-Related >> Java-J2EE >> Core-Java
 
 


 

Back to Questions Page
 
Question
IS method overriding is Duplication of Methods?
Rank Answer Posted By  
 Question Submitted By :: Sonali.nalawade
This Interview Question Asked @   CybAge
I also faced this Question!!   © ALL Interview .com
Answer
No. In method overriding the behaviour of overrided method 
is different. The subclass override only those methods, 
which has different behaviour than superclass else alawys 
use all the methods of superclass, which is better than 
making a lot duplication by defining another class for same 
methods of superclass.
 
0
Amol
 
 
Answer
yes
 
0
Guest
 
 
Question
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...
Rank Answer Posted By  
 Question Submitted By :: Sivadasan
This Interview Question Asked @   Cybernet
I also faced this Question!!   © ALL Interview .com
Answer
String strPageNum = request.getParameter(“pageNum”);
int pageNum = 0;
if(strPageNum != null){
pageNum = new Integer(strPageNum).intValue();
}
int maxRowsPerPage = new Integer(request.getParameter
(“rowsPerPage”)).intValue();
//calculate
int rowEnd = pageNum * maxRowsPerPage;
int rowStart = (rowEnd - maxRowsPerPage) + 1;
 
0
Avani
 
 
 
Answer
Thanks Avani...
 
0
Sivadasan
 
 
Question
What are uses of Hash Code?
Rank Answer Posted By  
 Question Submitted By :: Suraj Kumar
This Interview Question Asked @   Cognizent
I also faced this Question!!   © ALL Interview .com
Answer
1. When equals() method is invoked on java objects to check 
their equality, then the hash code of objects are checked. The 
two objects having same hash code are equal.
2. The objects having distinct hash code in HashTable 
increases the performance of HashTable. Hence, the objects 
should be checked its distinct hash code before storing into 
HashTable.
 
0
Suraj Kumar
 
 
Answer
memory location
 
0
Guest
 
 
Question
What is Hash Code in Java?
Rank Answer Posted By  
 Question Submitted By :: Guest
This Interview Question Asked @   Cognizent
I also faced this Question!!   © ALL Interview .com
Answer
In Java, object is associated with hash code. Hash Code is a 
signed number that identifies the object.
 
0
Guest
 
 
Question
when a servlet sends request for first time it uses  the 
follwing methods
a)init
b)doget()
c)dopost()
d)service
Rank Answer Posted By  
 Question Submitted By :: Sasirekha
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
when servlet gets first request, webcontainer loads the class and creates the object for it.
2)Constructor executes
3)webcontainer creates ServletConfig obj for servlet obj
4)init() method executes
5)service() method executes.
 
0
Sri
 
 
Question
System.out.println(101/14)
what is the output?
a)6
b)14
c)7.14
d)0
Rank Answer Posted By  
 Question Submitted By :: Sasirekha
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
answer is c
 
0
Sasirekha
 
 
Answer
7.14
 
0
Guest
 
 
Answer
Answer is 7 Only...it will not print the float value..
 
0
Sivadasan
 
 
Answer
System.out.println(101/14) It will print 7
 
0
Somasekhar
 
 
Answer
7.14
 
0
Krishna
 
 
Question
what is the Yield() method used in threads?
Rank Answer Posted By  
 Question Submitted By :: Sasirekha
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
yield method will allow other thread to execute.
 
0
Sasirekha
 
 
Question
How to find the size of an array
a)array.length()
b)array.length
c)array.size()
d)array.size
Rank Answer Posted By  
 Question Submitted By :: Sasirekha
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
length is a public static final variable in an array which
will specify the capacity of that array. length() is a
function on strings to find number of characters in that.
 
0
Nagesh
 
 
Answer
Answer 'C'
 
0
Sivadasan
 
 
Answer
answer is b
 
0
Somasekhar
 
 
Answer
Answer is  b
array.length  is for array 
and
array.size()  is for arraylist
 
0
Jigar Gandhi
 
 
Answer
array.lenth()
 
0
Krishna
 
 
Question
what is the output ?  Math.floor(-2.1)
a)2
b)-2
c)-3.0
d)0
Rank Answer Posted By  
 Question Submitted By :: Sasirekha
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
answer is -3.0
 
0
Sasirekha
 
 
Question
Hai all
I want to print given array in reverse order Ex:
int a[]={1,2,3,4,5};display this array in reverse order.
Rank Answer Posted By  
 Question Submitted By :: Srinivas123vasu
I also faced this Question!!   © ALL Interview .com
Answer
5
4
3
2
1
 
0
Guest
 
 
Answer
for(int i=a.length-1;i>=0;i--){
   System.out.println(a[i])
}
 
0
Nagesh
 
 
Question
What is difference between abstract class & final class
Rank Answer Posted By  
 Question Submitted By :: SatishK
I also faced this Question!!   © ALL Interview .com
Answer
abstract class can not instantiate.
abstract class can not create abstract constructor or static method.abstract class must be inherited. and vice versa final class.
 
0
Rajabhau
 
 
Answer
abstract class is a class that has no direct instance in 
the system but final class is a class in which we found the 
correct answer
 
0
Guest
[Ikanksha]
 
 
Answer
Abstract class is the one which is suppose to be extended
but
when we declare a class as final, we cannot extend it.
 
0
Amit Saxena
[Ikanksha]
 
 
Question
I have one Shopping cart application, i that i have 
selected some items, while clicking submit button by 
mistake i have clicked twice or trice, that time items are 
selected twice or trice. Actually i want only one copy of 
items but its selected twice or trice. So how can we avoid 
this problem?
Rank Answer Posted By  
 Question Submitted By :: Bosh
This Interview Question Asked @   Honeywell
I also faced this Question!!   © ALL Interview .com
Answer
Using token mechanism in struts we can duplicate requests in
web applications.
 
0
Balagangadhar
 
 
Answer
If this question in core (jave Collection): if you are 
using list,it will take the duplicate values. so pass 
through this list into set it will remove the duplicate 
values.

if this question in J2EE servlets: use post method, it it 
is not idempotent. once you add item to cart, it will give 
the acknowledge before changing in server.
 
0
Veera
 
 
Question
StringBuilder s = new StringBuilder("Hello
Mom");s.append(",I mean,Mother");
Response.Write(s.ToString());


String s = "Hello Mom";
s+ = ",I mean Mom";
Response.Write(s);

Which is faster ? which uses the most memory?
Rank Answer Posted By  
 Question Submitted By :: Chinna Reddy
I also faced this Question!!   © ALL Interview .com
Answer
The StringBuilder one is slightly more efficient and uses
less memory. In practice, it is unlikely to make enough of a
difference to matter either way.
 
0
Parameswaran M
 
 
Answer
The first one is faster

Second code snippets:3 objects are created

1:s = "Hello Mom"
2:,I mean Mom
3:Hello Mom,I mean Mom
 
0
Debapriya Maity
 
 
Answer
The first one is faster

Second code snippets:3 objects are created

1:s = "Hello Mom"
2:,I mean Mom
3:Hello Mom,I mean Mom
 
0
Debapriya Maity
 
 
 
Back to Questions Page
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com