File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to make method like getParameter()" Watch "How to make method like getParameter()" New topic

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;
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.
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:
subject: How to make method like getParameter()
It's not a secret anymore!