How do I create an array of a string?

How do I create an array of a string?



Here is the example code.



       

public class ArrayDemo {

 public static void main(String[] args) {
  String[] strArray = new String[2];
  strArray[0] = "Hello";
  strArray[1] = "World !";
  
  System.out.println(strArray[0] +" "+strArray[1]);
 }
}


 

       
Output:
Hello World !

 

Comments

Popular posts from this blog

Explain briefly about POJO in Java?