Akumaburn
Akumaburn

Reputation: 660

Java array concatenation using a comma?

I've got a bit of a puzzle I need help to unravel here and I've been unable to find the answer here thus far ITL.

In this file: https://bitcoinj.googlecode.com/git/core/src/main/java/com/google/bitcoin/core/PartialMerkleTree.java

Appears the line: byte[] left = recursiveExtractHashes(height-1, pos*2, used, matchedHashes).getBytes(), right;

Which eclipse seems to think is valid Java and it compiles just fine..

So what exactly does the ", right" portion perform?

I think its a declaration but I've never seen a declaration like this one.

Can anyone elaborate further?

Upvotes: 2

Views: 134

Answers (1)

SimplyPanda
SimplyPanda

Reputation: 725

This declaration is equivalent to something like this:

int i = 0, j;

right is declared but not initialized as an array of bytes, whereas left is both declared and initialized.

Upvotes: 7

Related Questions