Forums.Sureshkumar.net : A Perfect Place to Share Knowledge         Blogs     Games    Magazines    

"Sharing knowledge does not lessen your store, often it gets you more. Sharing plays a key role in relationships and bonding, happens in small steps and is assisted through community membership."

Go Back   SURESHKUMAR.NET FORUMS > TECHNICAL DISCUSSIONS > JAVA Technologies
Register FAQ Members List Calendar Games Blogs Search Today's Posts Mark Forums Read

   

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 15-02-06, 12:20 AM   #1 (permalink)
Member
 
Join Date: Feb 2006
Location: India
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 aparna3032 has disabled reputation


1)Can anyone tell me the main difference between overridding and inheritance?

2)At very first time how the server identifies the browser request and how it gives the response to the particular browser before the session is assigned?

Please try to answer this questions urgent.

Thanks & Rgds



aparna3032 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 15-02-06, 02:06 AM   #2 (permalink)
Senior Member
 
meenakshisekar's Avatar
 
Join Date: Feb 2006
Location: India
Posts: 546
Thanks: 7
Thanked 7 Times in 5 Posts
Thanks: 7
Thanked 7 Times in 5 Posts
Rep Power: 8 meenakshisekar has disabled reputation





.


inheritance:


inheritance is a property by which u canuse the datas and values of another class in ur class.


mainly inheritance can be used when ur more specific abtclass's functionality.


if u've created a class for salary calc of an employee


and after that u r in need of calculating overtime for that emp that time


instead of rewriting a class combiningsalcalc and ot calc u can simply extend salary class in ot class.


overriding :


overriding is mainly used to support run time polymorphism.


in class hierarchy when amethod in sub class has same name and type as super class then sub class method is said to overrride super class method.


run time polymorphism /dynamic method dispatch-is a mechanism by which a call to a overrriden method is resolved at runtime .


An instance method in a subclass with the same signature and return type as an instance method in the superclass overrides the superclass's method. (Remember that a method's signature is its name and the number and the type of its arguments.) You can also override a method with the same signature that returns a subclass of the object returned by the original method.
public class Animal {
public static void hide() {
System.out.format("The hide method in Animal.%n");
}
public void override() {
System.out.format("The override method in Animal.%n");
}
}



The second class, a subclass of Animal, is called Cat:
public class Cat extends Animal {
public static void hide() {
System.out.format("The hide method in Cat.%n");
}
public void override() {
System.out.format("The override method in Cat.%n");
}

public static void main(String[] args) {
Cat myCat = new Cat();
Animal myAnimal = myCat;
//myAnimal.hide(); //BAD STYLE
Animal.hide(); //Better!
myAnimal.override();
}
}



The Cat class overrides the instance method in Animal called override and hides the class method in Animal called hide. The main method in this class creates an instance of Cat and calls the hide on the class and override on the instance.


It is considered bad style to call static methods on instances because hiding can be confusing. So it is better to use the class, for example Animal.hide or Cat.hide. The output from this program is as follows:
The hide method in Animal.
The override method in Cat.
__________________
try try try till u succeed
meenakshi
meenakshisekar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 15-02-06, 04:36 AM   #3 (permalink)
Moderator
 
Join Date: Feb 2006
Posts: 1,413
Thanks: 0
Thanked 9 Times in 8 Posts
Thanks: 0
Thanked 9 Times in 8 Posts
Rep Power: 18 sowmya571 has disabled reputation
hello



1)Can anyone tell me the main difference between overridding and inheritance?





. Method overriding : When
a method in a class having the same method name with same arguments is said to
be method overriding.

There
is relationship between a superclass method and subclass
method.Overloading does not block inheritance from the superclass
whereas overriding
blocks inheritance from the superclass.In overriding, subclass method replaces the superclass.

overriding must have same signature.


Inheritance
is the process of inheriting all the features from a class. The advantages of
inheritance are reusability of code and accessibility of variables and methods
of the super class by subclasses

Inheritance is the process by which one object acquires the properties of
another object.



follow the examples of what meena has said ...



bye



sowmya





__________________
http://livetolead.blogspot.com/
all the best
Arise Awake N Stop Not Until Ur Goal Is Reached!
sowmya571 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 15-02-06, 04:45 AM   #4 (permalink)
Moderator
 
Join Date: Feb 2006
Posts: 1,413
Thanks: 0
Thanked 9 Times in 8 Posts
Thanks: 0
Thanked 9 Times in 8 Posts
Rep Power: 18 sowmya571 has disabled reputation
hello



At very first time how the server
identifies the browser request and how it gives the response to the
particular browser before the session is assigned?



well the answer is when ever we type an URL for an application the entire processing will be like this



1 Request for the webpage thru browser



2 Request is sent to
the server ( Every application will have server (mostly) since dynamic
HTML pages) This server will have a IP ADREESS OR PORT what ever ..



3 Here the request is being processed (known as application server- where business logic is be processed)



4 The application server as soon as the request is processed it will fetch the data thru the data base (if necessary )



5 from the data base info for the
request will be coming back to the application server or web server(
jus handles request n reponse no business logic processing will be done
)



6 the web server will send the response(WHAT EVER THE USER HAS REQUESTED ) back to the BROWSER



WELL EVERY SERVER(APPLICATION
SERVER /WEB SERVER WILL BE ASSOCIATED WITH PARTICULAR ADD RESS (which
is unique ) ... so that how entire communication will be done



hope i cleared ur doubt





if not please ask me



regards

sowmya




__________________
http://livetolead.blogspot.com/
all the best
Arise Awake N Stop Not Until Ur Goal Is Reached!
sowmya571 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +6.5. The time now is 03:15 AM.





Search Engine Optimization by vBSEO 3.1.0