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

Features

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
*tiles-defs.xml
*Struts DynaActionForm
*Struts File Upload
*Struts DataSource
*AGGREGATING ACTIONS
*Internationalization
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
roseindia_net@yahoo.com
 
   

 
Join For Newsletter

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

Core Java Interview Question Page 3

                         

Question: When you declare a method as abstract method ?

Answer: When i want child class to implement the behavior of the method.

Question: Can I call a abstract method from a non abstract method ? 

Answer: Yes, We can call a abstract method from a Non abstract method in a Java abstract class         

Question: What is the difference between an Abstract class and Interface in Java ? or can you explain when you use Abstract classes ? 

Answer: Abstract classes let you define some behaviors; they force your subclasses to provide others. These abstract classes will provide the basic funcationality of your applicatoin, child class which inherited this class will provide the funtionality of the abstract methods in abstract class. When base class calls this method, Java calls the method defined by the child class.

  • An Interface can only declare constants and instance methods, but cannot implement default behavior.
  • Interfaces provide a form of multiple inheritance. A class can extend only one other class.
  • Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc.
  • A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class.
  • Interfaces are slow as it requires extra indirection to find corresponding method in the actual class. Abstract classes are fast.

Question: What is user-defined exception in java ? 

Answer: User-defined expections are the exceptions defined by the application developer which are errors related to specific application. Application Developer can define the user defined exception by inherite the Exception class as shown below. Using this class we can throw new exceptions.

Java Example : public class noFundException extends Exception { } Throw an exception using a throw statement: public class Fund { ... public Object getFunds() throws noFundException { if (Empty()) throw new noFundException(); ... } } User-defined exceptions should usually be checked.

                         

Ask programming questions?

 

 

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

Current Comments

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

what is abstract class?

Posted by amutha on Sunday, 07.4.10 @ 10:15am | #97942

This site is a real great site.. Lot of handy codes and great tutorial. It really helped me to sort out many problems in project.

Posted by Avishek Ganguly on Tuesday, 12.1.09 @ 14:24pm | #92985

These are good questions.

Posted by Manish on Friday, 10.16.09 @ 09:49am | #91822

I really liked da tricky questions n their easy answers...
I wd tak sum mor help frm da site.

Posted by Shivam on Sunday, 06.14.09 @ 02:44am | #88478

This is very good site.

Posted by Sunil Chaudhari on Sunday, 01.11.09 @ 23:53pm | #83724

what is out in System.out? is it a static variable or public static variable

Posted by Manish on Wednesday, 10.1.08 @ 22:18pm | #80827

send me java interview questions

Posted by arun on Monday, 07.28.08 @ 12:15pm | #69519

what is the difference between Error and Exception.

Posted by Nagender on Friday, 01.18.08 @ 19:32pm | #45525

  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]