Results 1 to 3 of 3
Thread: call chaining
- 05-06-2010, 08:44 PM #1
Member
- Join Date
- May 2010
- Location
- Colorado
- Posts
- 6
- Rep Power
- 0
call chaining
What is the problem here..? Why doesn't this work?
public class Foo2 {
String a = "he";
String test1(){return a + "ll";}
String test2(){return "oo";}
String test3(){return "ow";}
}
public class Foo{
public static void main(String[] args) {
Foo2 foo = new Foo2();
String a = foo.test1().test2().test3();
System.out.println(a);
}
}
- 05-06-2010, 08:58 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Because test2 and test3 are not methods of String, and a String is what test1 and test2 return.
- 05-06-2010, 09:56 PM #3
Member
- Join Date
- May 2010
- Location
- Colorado
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
servlet chaining
By bbq in forum Java ServletReplies: 2Last Post: 01-23-2012, 09:02 AM -
call a JSP method
By sauravsinha in forum JavaServer Pages (JSP) and JSTLReplies: 4Last Post: 09-26-2011, 04:19 PM -
not able to call the ejb
By deepak9976 in forum Enterprise JavaBeans (EJB)Replies: 0Last Post: 08-07-2009, 10:12 AM -
how to call dll from java ??
By Omarero in forum New To JavaReplies: 3Last Post: 11-13-2008, 05:14 AM -
Hash table with separate chaining
By Java Tip in forum java.langReplies: 0Last Post: 04-12-2008, 08:42 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks