हिंदी

Differentiate between parselnt() and toString() functions. - Computer Applications

Advertisements
Advertisements

प्रश्न

Differentiate between parselnt() and toString() functions.

अंतर स्पष्ट करें
Advertisements

उत्तर

Sr. No. parselnt() functions toString() functions
1. This method in the Integer wrapper class converts a string to an integer. This method in the Integer wrapper class converts a basic data type (int) to a string data type.
2. Example: 
int n; 
String s = "34"; 
n = Integer.parseInt(s); // converts "34" i.e. (String) to 34 i.e. (int) 
Example:
int n = 24; String s; 
s = Integer.toString(n); 

Now that s has the value "24", mathematical operations cannot be performed on it.

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 2: Library Classes - EXERCISES [पृष्ठ १७९]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
अध्याय 2 Library Classes
EXERCISES | Q VII. 4. (b) | पृष्ठ १७९
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×