Question:
What is the output of the following code?
“`java
int Integer = 24;
char String = ‘I’;
System.out.print(Integer);
System.out.print(String);
“`
निम्नलिखित कोड का आउटपुट क्या है?
“`java
int Integer = 24;
char String = ‘I’;
System.out.print(Integer);
System.out.print(String);
“`
Options:
- I
- Compiler Error
- Throws Exception
- 24I
- I
- कंपाइलर त्रुटि (Compiler Error)
- अपवाद फेंकता है (Throws Exception)
- 24I
Correct Answer: d)
Explanation:
In Java, `Integer` and `String` are class names from the `java.lang` package, not reserved language keywords. Therefore, they can validly be used as variable identifiers. The code sets `Integer = 24` and `String = ‘I’`, and `System.out.print` prints them consecutively without a newline, resulting in `24I`.
जावा में `Integer` और `String` क्लास नाम हैं, आरक्षित कीवर्ड (reserved keywords) नहीं हैं। इसलिए, इनका उपयोग वेरिएबल के नाम के रूप में किया जा सकता है। कोड बिना किसी त्रुटि के निष्पादित होता है और `24I` प्रिंट करता है।