How to Declare a String in Java?

`String str = “Hello”;`

`String str = new String(“Hello”);`

`String str;`

`str = “Hello”;`

`final String str = “Hello”;`

`String[] strings = {“Hello”, “World”};`

Suggested for You

Trending Today