You can do the following during declaration:
String names[] = {"Ankit","Bohra","Xyz"};
And if you want to do this somewhere after declaration:
String names[];
names = new String[] {"Ankit","Bohra","Xyz"};
More Related Contents:
- Reading String for list of Integers separated by spaces [duplicate]
- How to replace a char with a string
- Android String that change every day
- Converting ‘ArrayList to ‘String[]’ in Java
- How to add new elements to an array?
- How to split a String by space
- A quick and easy way to join array elements with a separator (the opposite of split) in Java [duplicate]
- How to convert Java String into byte[]?
- Check string for palindrome
- How to convert a char array back to a string?
- How to convert object array to string array in Java
- string to string array conversion in java
- How can I get the size of an array, a Collection, or a String in Java?
- How do I convert a byte array to Base64 in Java?
- How to extract numbers from a string and get an array of ints?
- length and length() in Java
- Why does println(array) have strange output? (“[Ljava.lang.String;@3e25a5”) [duplicate]
- Convert array of strings into a string in Java
- Converting String to “Character” array in Java
- Convert String to int array in java
- Java String array: is there a size of method?
- Remove Null Value from String array in java
- Splitting String and put it on int array
- Is it possible in Java to override ‘toString’ for an Objects array?
- what is Ljava.lang.String;@
- In Java, how to append a string more efficiently? [duplicate]
- Random element from string array [closed]
- How to convert a Java String to an ASCII byte array?
- Why does byteArray have a length of 22 instead of 20?
- Java: Checking equality of arrays (order doesn’t matter)