+ 3
"String" is , though a class, used to store any primitive data type in java. It can store maximum amount of bytes in compare to other primitive data type.
It is very helpful as it make the program simple and shorter. Also original Java takes input in String format and convert it into asked data type.
It has the following syntax:
String <variable name> = <value (it can be of any data type)>
As per your convince , you can easily "type caste" String to desirable primitive data type, which will make the program shorter and more efficient.
Syntax of type conversion to String:
String <variable name>=<wrapper class of the converting primitive data type>.to String(variable name).
Syntax of type conversion of String to other primitive data type:
<data type> <variable name>=<wrapper class of the converting primitive data type>.parse<data type where first letter will be capital>
You can also refer here :
https://docs.oracle.com/javase/tutorial/java/data/strings.htmlI hope this will help you.
Keep practicing!!!âșïž