Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


Struts Tutorials
*Stuts TOC
*Apache Struts Introduction
* Struts Controller
* Struts Action Class
* Struts ActionFrom Class
* Using Struts HTML Tags
*Struts Validator Framework    
*Client Side Address Validation    
*Struts Tiles
*Struts DynaActionForm
*Struts File Upload
*Struts DataSource
Struts Resources
*Struts Books
*Struts Articles
*Struts Frameworks
*Struts IDE
*Struts Links
*Struts Presentations
*Struts Projects
*Struts Software
*Other Struts Tutorial
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail

Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Core Java Interview Question Page 32


java.lang & java.util Packages

Question: What is the ultimate ancestor of all java classes

Answer: Object class is the ancestor of all the java classes

Question: What are important methods of Object class

Answer: wait(), notify(), notifyAll(), equals(), toString().

Question: What is the difference between “= =” and “equals()”

Answer: “= =” does shallow comparison, It retuns true if the two object points to the same address in the memory, i.e if the same the same reference
“equals()” does deep comparison, it checks if the values of the data in the object are same

Question: What would you use to compare two String variables - the operator == or the method equals()?

Answer: I'd use the method equals() to compare the values of the Strings and the == to check if two variables point at the same instance of a String object

Question: Give example of a final class

Answer: Math class is final class and hence cannot be extended

Question: What is the difference between String and StringBuffer

Answer: String is an immutable class, i.e you cannot change the values of that class


String str = “java”; // address in memory say 12345
And now if you assign a new value to the variable str then
str = “core java”; then the value of the variable at address 12345 will not change but a new memory is allocated for this variable say 54321
So in the memory address 12345 will have value “java”
And the memory address 54321 will have value “core java” and the variable str will now be pointing to address 54321 in memory

StringBuffer can be modified dynamically
StringBuffer strt =”java” // address in memory is say 12345
And now if you assign a new value to the variable str then
Str = “core java”; then value in the address of memory will get replaced, a new memory address is not allocated in this case.

Question: What will be the result if you compare StringBuffer with String if both have same values

Answer: It will return false as you cannot compare String with StringBuffer

Question: What is Collection API

Answer: The Collection API is a set of classes and interfaces that support operation on collections of objects. These classes and interfaces are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables if effectively replaces.
Example of classes: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap.
Example of interfaces: Collection, Set, List and Map.

Question: What are different types of collections

Answer: A collection has no special order and does not reject duplicates
A list is ordered and does not reject duplicates
A set has no special order but rejects duplicates
A map supports searching on a key field, values of which must be unique

Question: Tell me something about Arrays

Answer: Arrays are fast to access, but are inefficient if the number of elements grow and if you have to insert or delete an element

Question: Difference between ArrayList and Vector

Answer: Vector methods are synchronized while ArrayList methods are not

Question: Iterator a Class or Interface? What is its use?

Answer: Iterator is an interface which is used to step through the elements of a Collection

Question: Difference between Hashtable and HashMap

Answer: Hashtable does not store null value, while HashMap does
Hashtable is synchronized, while HashMap is not


Ask programming questions?



Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

1 comments so far (post your own) View All Comments Latest 10 Comments:

no comments tell me the books questions are very good

Posted by deepak sharma on Tuesday, 08.3.10 @ 22:35pm | #98671

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name


Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.

[an error occurred while processing this directive]