This is default featured post 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Showing posts with label Java Fundamentals-FAQ. Show all posts
Showing posts with label Java Fundamentals-FAQ. Show all posts

aggregation and compositon

Aggregation:
  • it is an association in which one class belongs to a collection
  • this is part of a whole relationship where a part can exists without a whole 
  • a line item is a whole and product is a part. if a  line item is deleted then corresponding product need not be deleted
  • so aggregation has a weaker relationship
Composition:
  • it is an association in which one class belongs to a collection
  • this is a part of a whole relationship where a part cannot exist without a whole
  • if a whole is deleted then all parts are deleted
  • an order is a whole and line items are parts. if an order is deleted then all corresponding line items for that order should be deleted
  • so composition has a stronger relationship 

is a and has a relationship

  • the is-a relationship is expressed with inheritance 
  • has-a relationship is expressed with composition 
  • both inheritance and composition allow you to place sub objects inside your new class
  • two of the main techniques for code reuse are class inheritance and object composition 
  • inheritance is uni-directional 
  • for exam house is a build but building is not a house 
  • inheritance uses extends keyword 
  • composition is used when house has a bathroom
  •  it is incorrect to say house is a bathroom
  • composition simply means using instance variable that refer to other objects
  • the class house will have an instance variable which refers to bathroom object
  • don't use inheritance just to get code reuse if there is no is-a relation then use composition for code reuse
  • overuse of implementation inheritance can break all the subclasses, if the superclass is modified 
  • don't use inheritance just to get polymorphism, if there is no is-a relation and all you want is polymorphism then use interface inheritance with composition, which gives you code reuse

adv of object oriented progrmming language

  • the object oriented programing language directly represent the real life objects like car . 
  • the features of oo programming language like polymorphism, inheritance and encapsulation make it powerful 
  • remember 'pie' 

constructors faq

  1. what happen if you do not provide  a constructor------> default constructor
  2. can you call one constructor from another------------>this()
  3. how to call the super class constructor----------->super()

difference between constructors and methods

Constructor:
  • constructors must have the same name as the class name and cannot return a value.
  • the constructor are called only once per creation of an object while regular methods can be called many times
Ex: For a pet class ,
public Pet()
{
}


Method:
  • methods can have any name and can be called any number of time 
Ex: for a pet class
public void Pet()
{
}


class loaders

  • class loaders are hierarchical 
  • it is divided into static and dynamic 
  • for static class loading we will consider "new" operator ex:- Car c=new Car(); 
  • for dynamic class loading we will consider "forName"  ex:- Class.forName(String className);

packages

  • it helps resolve naming conflicts when different packages have classes with the same names. For example, when we are dealing with io package ie., java.io package which means something related to input output and if the package java.net package which means something related to networking 
  • this also helps you organize files with in your project
  • you can create a package as follows with package keyword which is the first keyword in any java program followed by import statements
Example

package com.abc.client;
import java.io.*;
import java.util.*;

identifiers

  • identifiers can begin with a letter, an underscore, or a currency character
  • after the first character, identifiers can also include digits.
  • identifiers can be of any length
  • java beans methods must be named using camelCase, and depending on the method's purpose, must start with set, get, is add or remove

java platform

  • JVM
  • Java API

difference between java and c++

  • pointers issue
  • multiple inheritance issue
  • destructor and finalize issue
  • structures/unions and collection framework issue 
  • memory management issue(garbage collections)

resons for using java

  • built-in support for multithreading, socket communication and memory management 
  • object oriented
  • better probtability than other languages across OS
  • support web based application,distributed applications and network protocols with the help of standard api's 

Gallary

Html Tutorial Day-1 Html Tutorial Day-10 Html Tutorial Day-2 Html Tutorial Day-3 Html Tutorial Day-4 Html Tutorial Day-5 Html Tutorial Day-6 Html Tutorial Day-7 Html Tutorial Day-8 Html Tutorial Day-9 J2SE day 1 J2SE day 2 J2SE day 3 Jaap Jaas Java Fundamentals-FAQ jaxp Jdbc tutorial Day-1 Jdbc tutorial Day-10 Jdbc tutorial Day-11 Jdbc tutorial Day-12 Jdbc tutorial Day-13 Jdbc tutorial Day-14 Jdbc tutorial Day-15 Jdbc tutorial Day-16 Jdbc tutorial Day-17 Jdbc tutorial Day-18 Jdbc tutorial Day-19 Jdbc tutorial Day-2 Jdbc tutorial Day-3 Jdbc tutorial Day-4 Jdbc tutorial Day-5 Jdbc tutorial Day-6 Jdbc tutorial Day-7 Jdbc tutorial Day-8 Jdbc tutorial Day-9 jndi Jsp Day 1 Jsp Day 2 Jsp Day 3 Jsp Day 4 JSP Intoduction Jta Jts Nms Day 1 Servlet Faq 1 Servlet Tutorial Day-1 Servlet Tutorial Day-2 Servlet Tutorial Day-3 Servlet Tutorial Day-4 Servlet Tutorial Day-7 Spring FAQ Spring Tutorial Day-1 Spring Tutorial Day-2 Spring Tutorial Day-3 Spring Tutorial Day-4 Spring Tutorial Day-5 Struts FAQ Struts Tutorial Day-1 Struts Tutorial Day-10 Struts Tutorial Day-11 Struts Tutorial Day-12 Struts Tutorial Day-13 Struts Tutorial Day-2 Struts Tutorial Day-3 Struts Tutorial Day-4 Struts Tutorial Day-5 Struts Tutorial Day-6 Struts Tutorial Day-7 Struts Tutorial Day-8 Struts Tutorial Day-9 Struts Tutorial Day-9.1 Two Minute Drill WebServices tutorial Day 1 WebServices tutorial Day 2 WebServices tutorial Day 3 WebServices tutorial Day 4 WebServices tutorial Day 5 WebServices tutorial Day 6 WebServices tutorial Day 7

Popular Posts

Twitter Delicious Facebook Digg Stumbleupon Favorites More