मराठी

Explain the process of Initializing a String in Java.

Advertisements

प्रश्न

Explain the process of Initializing a String in Java.

स्पष्ट करा
Advertisements

उत्तर

In Java, String declaration is the process of declaring a reference variable of the String class. A String is declared by writing the class name String followed by a valid variable name and a semicolon. This declaration creates a reference variable that can refer to a String object, but no String value is assigned at this stage.

  1. Write the class name String.
  2. Specify a valid variable name.
  3. End the declaration with a semicolon (;).

Syntax:

String variableName;

Example:

String name; 
In the above example, String is the class name, and name is the reference variable declared to refer to a String object.
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 5: Primitive Values, Wrapper Classes, Types and Casting - EXERCISE [पृष्ठ ११२]

APPEARS IN

धीरज मेहरोत्रा Computer Science [English] Class 12
पाठ 5 Primitive Values, Wrapper Classes, Types and Casting
EXERCISE | Q 9. (ii) | पृष्ठ ११२
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×