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   SiteMap shows list of All Categories in this site.
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
 
 
Answer
No.In subclass we will extend the functionality of super
class method.
 
0
Naveen Kumar Raavi
 
 
 
Answer
To understand the Question, one needs to know the scenarios 
where in a method is overriden.
there are two cases:
you want to override a method:
1)when the super class doesnt know how to implement it, and 
leaves the implementation to the sub-class.
2)when the subclass feels, it has to add few more details 
specific to itself than which are provided by the 
superclass.

so there is no duplication happening provided one overrides 
a method sensibly(understanding thorougly if overriding a 
method is necessary or not).if one wishes to write things 
that are already available, it is then called "duplication 
of code",
 
0
Venkat
 
 
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
 
 
Answer
Answer is 7,
as int is the default datatype for numeric values..  Not float.
 
0
Sanchit
 
 
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
 
 
Answer
This static method is essentially used to notify the system that the current thread is willing to "give up the CPU" for a while. The general idea is that:
The thread scheduler will select a different thread to run instead of the current one.
 
0
Chikku
 
 
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
 
 
Answer
array.length
 
0
Ashish Shinkar
 
 
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
 
 
Answer
Math.floor(x) function will return the nearest integer which
is less than the passed value x.

Since -3.0 < -2.1,
-3.0 is the nearest smallest integer.

so answer is c)-3.0
 
0
Amarnath88888
 
 
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]
 
 
Answer
An abstract class is one which can't be instantiated, as it 
contains one or more abstract methods( methods that are 
only declared, their implementation is left for 
subclasses).An abstract class always needs to be extended 
in order to be used.
A Final class is one which can't be extended/inherited.
 
0
Pallavi
[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
 
 
Answer
The second one is faster.

In the first example the StringBuilder is initialized with
an initial value. Then the append method is ran, adding
another string to 's'. Then the Write method is called,
which calls the ToString() method of 's'.
Total Steps:
1.) Initialize and set initial value
2.) Append
3.) Write
4.) ToString()

In the second example the String is initialized with an
initial value. Then a string is added onto 's'. Then the
Write method is called.
Total Steps:
1.) Initialize and set initial value
2.) Add String to String
3.) Write

Therefore I would say that the second example is faster, and
uses less memory.
 
0
Jimmy Dean
 
 
Question
why interaction with server using javascript is difficult
Rank Answer Posted By  
 Question Submitted By :: Rajendra007
I also faced this Question!!   © ALL Interview .com
Answer
Java script is Object based Language not object oriented. 
It is a scipting languge for client side validations only.
It reduces the load on the server by validating the user's 
input.

(Object based languages dont support polymorphism and 
inheritance. It is difficult to interact with server 
without these concepts.)
 
0
Pavan
 
 
 
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