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
posted
0
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: