Mode of calling/performance difference
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Syam_Prasad
Posted On:   Thursday, October 25, 2001 08:38 AM

If I want to call any method from the class I can declare an object of that type and call method. For Ex. I have one method in my class which returns httpsession. public class AppRequest { public HttpSession getHttpSession() { HttpSession objHttpSession; return HttpSession; } } Now every time I call method of HttpSession I call this method to get HttpSession like this. I can do this in two ways. Ist one. public void setValues(AppRequest obj) { HttpSession httpSession = obj.getHttpSession(); httpSession.setAttribute("key", "value"); } or 2nd one. public void setValues(AppRequest obj) { o   More>>

If I want to call any method from the class I can declare an object of that type and call method.


For Ex.
I have one method in my class which returns httpsession.
			
public class AppRequest {
public HttpSession getHttpSession() {
HttpSession objHttpSession;
return HttpSession;
} }


Now every time I call method of HttpSession I call this method to get HttpSession like this. I can do this in two ways.



Ist one.
			
public void setValues(AppRequest obj) {
HttpSession httpSession = obj.getHttpSession();
httpSession.setAttribute("key", "value");
}

or 2nd one.
			
public void setValues(AppRequest obj) {
obj.getHttpSession.setAttribute("key", "value")
}

The method which I am calling and the method which returns HttpSession are in two different classes.



which way is better and also will there be any performance difference/ memory storage.



I really appreaciate your cooperation.    <<Less
About | Sitemap | Contact