1.

How to declare a string in Java?

Answer»

String DECLARATION in Java can be DONE in TWO ways:

  • By string LITERAL: Double quotes are used to create Java String literals. 
    • Example: String str= "SCALER";  
  • By new keyword: Keyword "new" is used to create a Java string.
    • Example: String str=new String ("Scaler");


Discussion

No Comment Found