Page 70 - CITS - CSA - TP (Volume 2) - Hindi
P. 70
कं ूटर सॉ वेयर ए ीके शन - CITS
// shortValue()
short shortResult = shortValue.shortValue();
System.out.println(“shortValue(): “ + shortResult);
// intValue()
int intResult = shortValue.intValue();
System.out.println(“intValue(): “ + intResult);
// longValue()
long longResult = shortValue.longValue();
System.out.println(“longValue(): “ + longResult);
// floatValue()
float floatResult = shortValue.floatValue();
System.out.println(“floatValue(): “ + floatResult);
// doubleValue()
double doubleResult = shortValue.doubleValue();
System.out.println(“doubleValue(): “ + doubleResult);
}
}
आउटपुट:
3 इंटीजर
• 32-िबट साइंड इंटीजर का ितिनिध करता है।
• िविधयों म शािमल ह : intValue(), longValue(), floatValue(), doubleValue()
Task_Integer: यहाँ एक उदाहरण ो ाम िदया गया है जो Integer वग के िलए Number ास से ा िविधयों के उपयोग को दिश त
करता है:
public class IntegerMethodsExample {
public static void main(String[] args) {
// Example using Integer class
Integer intValue = 42;
// intValue()
int intResult = intValue.intValue();
System.out.println(“intValue(): “ + intResult);
56
CITS : IT & ITES - कं ूटर सॉ वेयर ए ीके शन - अ ास 90

