Showing posts with label Inheritance. Show all posts
Showing posts with label Inheritance. Show all posts

Thursday, 28 June 2012

Java Training: - How do you implement inheritance in Java?

To understand this better lets do a small project to get the actual feel of the same.

Below is the project structure of the “Inheritance” project. It has the three classes:-

• “ClsAdd.java”
This class has a basic subroutine which adds two numbers.

• “ClsSpecialAdd.java”
This class inherits from “ClsAdd.java” and overrides the subroutine which does the basic addition. It changes the basic addition functionality a bit by adding the two numbers but also adds up an extra adjustment value “20”.

• “ClsRun.java”
This is the class which has the “public static void main (String [] args)” method. It’s the main class which will run the whole show by creating the objects of “ClsAdd” and “ClsSpecialAdd” and executing the “Add” method.

Figure: - Project File structure of inheritance structure

Figure: - Inheritance in Action


When you run the project you can see two outputs one from the parent class and second from the child class with the adjustment value added up. So the child class has made the parent add class more specialized.

Figure: - Output from Inheritance Project


See the following video on Inheritance between beans and Springin Java: -



Click to get Java Training

Regards,

Get more Java training stuffs from author's blog

Wednesday, 14 March 2012

Java Interview Questions: – Can you explain the main components of JDBC?

This is the most practical oriented Java Interview Questions which may be asked during the Interview by the Interviewer.

Driver Manager:
  • Manages a list of database drivers.
  • Matches connection requests from the java application with the proper database driver using communication
Driver:
  • The database communications link, handling all communication with the database.
  • Normally, once the driver is loaded, the developer need not call it explicitly.
Connection
  • Interface with all methods for contacting a database
  • Represents communication context, i.e., all communication with database is through connection object only.
Statement
  • Encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.
Result Set
  • The ResultSet represents set of rows retrieved due to query execution
Data source
  • is a facility for storing data
  • Data Source may point to RDBMS, file system, any DBMS
See the following video on Inheritance between beans and Spring: -



Click for more Java interview questions

Regards,

Visit for more author’s blog on Java interview questions

Friday, 13 January 2012

JAVA INTERVIEW QUESTIONS: - 20 BASICS INTERVIEW QUESTIONS ON JAVA? Part: -2.

  • What is a native method?
  • Does Java provide any construct to find out the size of an object?
  • Is Empty .java file a valid source file?
  • Can a .java file contain more than one java classes?
  • What is the difference between an argument and a parameter?
  • What is UNICODE?
  • What are Transient and Volatile Modifiers?
  • What are the different scopes for Java variables?
  • What are wrapper classes?
  • What is a the difference between System.err and System.out?
  • What are the contracts defined by .equals()?
  • If two objects are considered equal by .equals() , can it be said they has same hashCode()?
  • If two objects have same hashCode() is it necessary they will be equal by using .equals() method?
  • What contracts hashCode () defines?
  • What is the difference between == and equals?
  • What is the difference between List and List (not parameterized list and list parameterized by String) in Java?
  • What are generics in jdk1.5?
  • Are generics covariant?
  • What are Lower-bounded wildcards in generics?
  • What is Upper bounded wildcards in generics?
View the following video on Inheritance between beans and Spring in Java: -



For more on  Java interview questions so click and visit.

Regards,

Author’s more on Java interview questions

Friday, 6 January 2012

Java Interviews questions: -How can you explain views and its type?

A view can be thought of as either a virtual table or a stored query is a database object that is a logical representation of a table Views are mainly classified as

Simple view:
  • is created by selecting only one table
  • does not contains functions.
  • can perform operations through simple view
Complex view :
  • It is created by selecting more than one table.
  • It can performs functions.
  • can not perform always DML operations
Also see the following interesting video on Java - Inheritance between beans and Spring : -



Know more on Java interview questions

Regards,

Get more on Java interview questions from author’s blog