1
asked in 1 exam1 परीक्षा में पूछा गया
JAVA AND THE JVMजावा और जेवीएम
Java was developed at SUN MICROSYSTEMS and is now owned by Oracle. It is an OBJECT-ORIENTED programming language.
- Your source code compiles to BYTECODE, which the JAVA VIRTUAL MACHINE, the JVM, executes
- So the same program runs on any platform that has a JVM
- Execution starts at the main() method: public static void main(String[] args)
- The java.lang package is imported automatically into every program
- आपका सोर्स कोड बाइटकोड में कंपाइल होता है, जिसे जावा वर्चुअल मशीन, अर्थात् जेवीएम, चलाती है
- इसलिए वही प्रोग्राम हर उस प्लेटफॉर्म पर चलता है जिसमें जेवीएम हो
- निष्पादन main() मेथड से शुरू होता है: public static void main(String[] args)
- java.lang पैकेज हर प्रोग्राम में अपने आप इम्पोर्ट होता है
2
asked in 1 exam1 परीक्षा में पूछा गया
CLASSES, OBJECTS AND INHERITANCEक्लास, ऑब्जेक्ट और इनहेरिटेंस
These keywords are asked one at a time.
- new creates an object; this refers to the current object
- extends inherits a class. A class extends only one class
- MULTIPLE INHERITANCE comes through INTERFACES, with implements
- final declares a constant: a final variable cannot be given a new value
- new ऑब्जेक्ट बनाता है; this वर्तमान ऑब्जेक्ट को दर्शाता है
- extends क्लास इनहेरिट करता है। एक क्लास केवल एक क्लास को extend करती है
- मल्टिपल इनहेरिटेंस इंटरफेस से आता है, implements के साथ
- final स्थिरांक घोषित करता है: final चर को नया मान नहीं दिया जा सकता
3
asked in 1 exam1 परीक्षा में पूछा गया
TYPES, OPERATORS AND LOOPSटाइप, ऑपरेटर और लूप
- Eight PRIMITIVE types: byte, short, int, long, float, double, char and boolean. STRING is a class, NOT a primitive
- Array indexing starts at 0
- && is the conditional AND: it checks the right operand only if the left one is true
- do-while runs its body AT LEAST ONCE; while and for may not run at all
- LAMBDA EXPRESSIONS came in JAVA 8
- आठ प्रिमिटिव टाइप: byte, short, int, long, float, double, char और boolean। String एक क्लास है, प्रिमिटिव नहीं
- ऐरे की गिनती 0 से शुरू होती है
- && कंडीशनल एंड है: यह दायाँ ऑपरेंड तभी जाँचता है जब बायाँ सत्य हो
- do-while अपना भाग कम से कम एक बार चलाता है; while और for बिल्कुल न भी चलें
- लैम्ब्डा एक्सप्रेशन जावा 8 में आए
4
asked in 1 exam1 परीक्षा में पूछा गया
MEMORYमेमोरी
THE HEAP AND METASPACEहीप और मेटास्पेस
- Your objects live on the HEAP, which the GARBAGE COLLECTOR clears when they are no longer used
- From Java 8, class metadata sits in METASPACE, in native memory, in place of the old PermGen
- When Metaspace runs out, the JVM throws OutOfMemoryError: Metaspace
- आपके ऑब्जेक्ट हीप पर रहते हैं, जिसे गार्बेज कलेक्टर उपयोग न रहने पर साफ करता है
- जावा 8 से क्लास का मेटाडेटा पुराने परमजेन के स्थान पर मेटास्पेस में, नेटिव मेमोरी में रहता है
- मेटास्पेस भर जाने पर जेवीएम OutOfMemoryError: Metaspace देती है