mr.user1065741
mr.user1065741

Reputation: 692

Define an array within calling of a function in java

Currently I have the code that is below.

String[] ans = {"Yes","No"};
option = questionAsk("Are you sure?",ans);

I have tried simply sticking the definition of 'ans' into the call of the function and have tried to change it around but I cannot seem to find how to make these two lines become one.

Upvotes: 0

Views: 85

Answers (1)

jlordo
jlordo

Reputation: 37823

You can define an array when calling a method:

option = questionAsk("Are you sure?", new String[]{"Yes","No"});

Upvotes: 13

Related Questions