Results 1 to 4 of 4
- 04-08-2010, 01:48 PM #1
Member
- Join Date
- Feb 2010
- Posts
- 36
- Rep Power
- 0
calculating with values out of another class
hey,
I was wonderring how you can calculate in one class using values out of antother class.
For example:
public class First{
private int firstNumber;
private int secNumber;
......
}
public class Second{
......
public void makeSumofnumberintheotherclass(){
.....
}
- 04-08-2010, 01:50 PM #2
There is no wonder here.Learn the fundamentals and then try writing the code.
Ramya:cool:
- 04-08-2010, 02:03 PM #3
Member
- Join Date
- Feb 2010
- Posts
- 36
- Rep Power
- 0
helpfull...
- 04-08-2010, 03:01 PM #4
you could have two public methods getFirstNumber and getSecNumber in your First class that returns the values to the Second class. if more numbers are envolved then the First class could also return an array of numbers. perhaps you could also make your calculations directly in the First class, so that you don't need to pass nothing between classes. this depends on your design.
Last edited by j2me64; 04-08-2010 at 03:06 PM.
Similar Threads
-
problem in accessing array values of one class in to jframe class
By cenafu in forum AWT / SwingReplies: 8Last Post: 03-21-2009, 09:34 AM -
writing array values to another class
By ronald christian in forum New To JavaReplies: 27Last Post: 11-07-2008, 04:08 PM -
How to set values with Calendar class ?
By mohiit in forum New To JavaReplies: 3Last Post: 05-14-2008, 04:21 AM -
Inner Class and Calling Values
By a45b22chp in forum New To JavaReplies: 3Last Post: 04-25-2008, 08:48 PM -
Accessing boolean Values of another values in one class.
By a_iyer20 in forum Advanced JavaReplies: 4Last Post: 04-15-2008, 01:04 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks