Debopam
Debopam

Reputation: 3356

char** equivalent in Java

I am converting a C++ project into Java. I have one doubt, what is the equivalent of char** in Java, is it String[] or String[][]?

Upvotes: 0

Views: 873

Answers (3)

saver
saver

Reputation: 400

char[][] or String[]. Depends on context

Upvotes: 7

molbdnilo
molbdnilo

Reputation: 66441

You can't really express the meaning of char** in Java so there's no equivalent, but if that's actually a pointer to the first element of an array of zero-terminated C-strings, then String[] is as close as you can get.

If it's a two-dimensional "pseudo-array" of char, then char[][] is close enough.

If it's neither but just a pointer to a pointer, then there's no equivalent.

Upvotes: 1

Thom
Thom

Reputation: 15052

I would say String[] if I remember correctly. String is a handle and that would be an array of handles.

Upvotes: -1

Related Questions