Results 1 to 3 of 3
- 05-03-2012, 06:39 PM #1
Member
- Join Date
- May 2012
- Posts
- 6
- Rep Power
- 0
call method in another class with array ? (is possible?)
Hi!
I have one small question. Is that possible?
andJava Code:public class test1 { public static void main (String[] args){ test2 client = new test2(); test2[] call = new test2[1000]; int x =2; call[1].add1(x); } }
Sorry for my bad English.Java Code:public class test2 { void add1(int x) { x = x+1; } }
- 05-03-2012, 07:04 PM #2
Member
- Join Date
- Sep 2011
- Location
- Athens Greece
- Posts
- 29
- Rep Power
- 0
Re: call method in another class with array ? (is possible?)
It is legal piece of code. You allocate an array of test2 object in line 4
and you call one of the class method in line 6.Although it does nothing to change the value of variable x;
- 05-03-2012, 07:12 PM #3
Member
- Join Date
- May 2012
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
read or call an array from other class an method
By ki_ha1984 in forum New To JavaReplies: 5Last Post: 01-23-2012, 10:42 PM -
Inner class method call
By d915172 in forum New To JavaReplies: 3Last Post: 11-11-2010, 09:40 PM -
how call from inner class(anonymous or not), a method of parent class?
By lse123 in forum AWT / SwingReplies: 2Last Post: 05-01-2010, 08:59 AM -
How to call a method from another class?
By jboy in forum New To JavaReplies: 8Last Post: 09-09-2009, 07:29 AM -
How to call a class within a method
By Manfizy in forum New To JavaReplies: 3Last Post: 03-19-2009, 12:34 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks