Wow. First, assignments are done with =, not ==, but the rest of that expression is completely baffling to me. Generally speaking it's best to do a job as simply as possible. In this case, that would be three for loops:

Once you get a little more comfortable, you can think about System.arraycopy() or something fancier. Now, as I say, I'm baffled by the expression you wrote out, so it's entirely possible that your assignment is calling for something more complex than just combining three arrays into one. Hopefully, this will get you started though.

Greg Charles wrote:Wow. First, assignments are done with =, not ==, but the rest of that expression is completely baffling to me. Generally speaking it's best to do a job as simply as possible. In this case, that would be three for loops:

Once you get a little more comfortable, you can think about System.arraycopy() or something fancier. Now, as I say, I'm baffled by the expression you wrote out, so it's entirely possible that your assignment is calling for something more complex than just combining three arrays into one. Hopefully, this will get you started though.

yes the assignement is very complex...........i donot know how i am able to complete.........i m theonly person who is gng to write the code for this...............

OK, deep breaths. You'll get through it. Representing formulas into code is actually one of the more straightforward things to do in programming. It's mainly a matter of knowing what the formula is and then getting the parentheses right. I'm not clear what you intend "output" to be here. Is it an array with n elements or a single value? Also, when you wrote "x" in your formula are you intending that to be a variable x, or multiplication? In any case, if you can state what you want to do in English, then it won't be that much harder to do it in Java.

Ah, I see. Well, there are several reasons that doesn't work. First, the "sum" method is not part of Java's Math class. I looked at that link, and I'm not sure exactly what's it's documenting, but it's not the Java API. Google "javadoc Math" and you'll get better results.

Another problem is that certain operators they use in their example, like "^" for exponents and "!" for factorials, just don't work that way in Java.

Finally, passing an expression as an argument to a method is something called a closure, which is simply not supported in the Java language at the moment. You can approximate the idea though with an interface and an anonymous inner class. I would definitely suggest working out the functionality first with for-loops, then think about introducing a slick pseudo-closure into the mix.