Which of the following is a valid declaration of a String in Java?
A. String str = "hello";
B. String str = new String("hello");
C. Both a and b.
D. None of the above.
Answer:C
Which of the following is a valid declaration of a String in Java?
A. String str = "hello"; B. String str = new String("hello"); C. Both a and b. D. None of the above.