For example, determine the size when declaring a string array variable (String[5]), as shown below I have to declare it. String[] apple = new String[5];
But what I need is not an array of strings of a given size 1 character for a specific character, 2 characters for a specific character, etc The size of the arrangement needs to be determined as much as it is put in.
java array string
// If the length of "aaa" is greater than 4, the condition may be given as a 5 or 4. trinomial operator.
String s = new String["aaa".length() > 4 ? 5 : 4]
© 2024 OneMinuteCode. All rights reserved.