Two Laptop Bag*
The moose likes Java in General and the fly likes How to make method like getParameter() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to make method like getParameter()" Watch "How to make method like getParameter()" New topic
Author

How to make method like getParameter()

Huzefa Zohaib
Ranch Hand

Joined: Nov 21, 2001
Posts: 40
See the following code
public ClassA {
public static void main(String[]args) {
ClassB a= new ClassB ();
a.inter (2,'c',4);
}
}
public ClassB {
public _________ inter (int a, char c, int b) {
int d= a*b;
int e= a;
int f= b;
char g= c;
return;
}
}
what should be the reutrn type of inter(), so that I can get the value of d,e,f,g particularly when I want or when desired.
I want some thing like getParameter() which is in the HttpServletRequest object in the servlet.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
When you're dealing with J2EE you'll see the 'pattern' DTO (Data Transfer Object). A DTO for your example would look something like this:

Your 'inter' method could be rewritten as follows:

and the calling code could look something like this:

kind regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make method like getParameter()
 
Similar Threads
Referring a Local Inner Class
2D array: Find an array of characters
Not able to post code snippets.
Logic with java code
Member Visible in Sub Class?