Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> Java

जावा 9 में JShell डॉक्यूमेंटेशन कैसे प्राप्त करें

जावा 9 ने JShell नामक एक नया इंटरैक्टिव टूल पेश किया। इस टूल का उपयोग एक्सप्रेशन्स, क्लासेस, इंटरफेसेस, एनम्स आदि को निष्पादित करने के लिए किया जा सकता है।

विस्तृत डॉक्यूमेंटेशन JShell में पूर्ण जानकारी के साथ, साथ ही इसके आंतरिक कमांड्स के उपयोग को विभिन्न विकल्पों के साथ उपलब्ध कराया जा सकता है। इस डॉक्यूमेंटेशन को दो कमांड्स का उपयोग करके एक्सेस किया जा सकता है: "/help" और "/?"। JShell का डॉक्यूमेंटेशन न केवल इसके आंतरिक नियंत्रणों के बारे में जानकारी तक सीमित है, बल्कि इसमें Javadoc भी शामिल है।

नीचे दिए गए कोड स्निपेट में, परिणाम "/help" कमांड का उपयोग करके प्राप्त किया जा सकता है।

jshell> /help | Type a Java language expression, statement, or declaration. | Or type one of the following commands: | /list [|-all|-start] | list the source you have typed | /edit  | edit a source entry referenced by name or id | /drop  | delete a source entry referenced by name or id | /save [-all|-history|-start]  | Save snippet source to a file. | /open  | open a file as source input | /vars [|-all|-start] | list the declared variables and their values | /methods [|-all|-start] | list the declared methods and their signatures | /types [|-all|-start] | list the declared types | /imports | list the imported items | /exit | exit jshell | /env [-class-path  ] [-module-path ] [-add-modules ] ... | view or change the evaluation context | /reset [-class-path ] [-module-path ] [-add-modules ]... | reset jshell | /reload [-restore] [-quiet] [-class-path ] [-module-path ]... | reset and replay relevant history -- current or previous (-restore) | /history | history of what you have typed | /help [|] | get information about jshell | /set editor|start|feedback|mode|prompt|truncation|format ... | set jshell configuration information | /? [| ] | get information about jshell | /! | re-run last snippet | / | re-run snippet by id | /- | re-run n-th previous snippet | For more information type '/help' followed by the name of a command or a subject. | For example '/help /list' or '/help intro'. | | Subjects: | | intro | an introduction to the jshell tool | shortcuts | a description of keystrokes for snippet and command completion, | information access, and automatic code generation | context | the evaluation context options for /env /reload and /reset

JShell विभिन्न मौजूदा आंतरिक कमांड्स को उनके कार्यों की त्वरित प्रस्तुति के साथ प्रिंट करता है, और इसके उपयोग का अधिक विस्तृत विवरण एक्सेस करता है। इसके लिए, हमें बस कमांड दर्ज करनी होगी: "/help" इसके बाद विस्तार से एक कमांड का नाम (उदाहरण के लिए, "/set" कमांड)।

jshell> /help /set | | /set | | Set jshell configuration information, including: | the external editor to use, the start-up definitions to use, a new feedback mode, | the command prompt, the feedback mode to use, or the format of output. | | /set editor [-wait] ... | Specify the command to launch for the /edit command. | The  is an operating system dependent string. | | /set start  | The contents of the specified become the default start-up snippet s and commands. | | /set feedback  | Set the feedback mode describing displayed feedback for entered snippets and commands. | | /set mode [] -command|-quiet|-delete | Create or update a user-defined feedback mode, optionally copying from an existing mode. | | /set prompt "" "" | Set the displayed prompts for a given feedback mode. | | /set truncation    ... | Set the maximum length of a displayed value. | | /set format   "" ... | Configure a feedback mode by setting the format of a field when the selector matches. | | /set | Show editor, start, and feedback settings as /set commands. | To show the settings of any of the above, omit the set value. | To get more information about one of these forms, use /help with the form specified. | For example: /help /set format

हमें इस तीसरे भाग के दौरान दर्ज कमांड्स को खोजने की आवश्यकता है, चाहे JShell की वापसी को संशोधित करना हो (/set feedback), डिफ़ॉल्ट एडिटर को संशोधित करना हो (/set editor), या JShell की शुरुआत को संशोधित करना हो (/set start)।

jshell> /help /set feedback | Set the feedback mode describing displayed feedback for entered snippets and commands: | | /set feedback [-retain]  | | Retain the current feedback mode for future sessions: | /set feedback -retain | | Show the feedback mode and list available modes: | /set feedback | | Where  is the name of a previously defined feedback mode. | You may use just enough letters to make it unique. | User-defined modes can be added, see '/help /set mode' | | When the -retain option is used, the setting will be used in this and future | runs of the jshell tool. | | The form without  or -retain displays the current feedback mode and available modes.
  1. - जावा में वर्तमान डेट कैसे प्राप्त करें?

    आप जावा में विभिन्न तरीकों से वर्तमान डेट प्राप्त कर सकते हैं। उनमें से कुछ निम्नलिखित हैं: Date क्लास का कंस्ट्रक्टर java.util.Date क्लास का नो-आर्ग कंस्ट्रक्टर वर्तमान डेट और टाइम को दर्शाने वाला Date ऑब्जेक्ट लौटाता है। इसका उपयोग करके आप वर्तमान डेट प्रिंट कर सकते हैं। उदाहरण import java.text.S

  1. - JShell में Java 9: सिस्टम प्रॉपर्टीज कैसे प्राप्त करें

    JShell Java 9 का REPL टूल है जो बिना main() मेथड के Java कोड को इंटरैक्टिव रूप से चलाने की अनुमति देता है। इसे कमांड लाइन पर jshell टाइप करके शुरू किया जा सकता है। सिस्टम प्रॉपर्टीज एक्सेस करने के तरीके 1. एकल प्रॉपर्टी प्राप्त करना: System.getProperty(key) विशिष्ट कुंजी के लिए मान लौटाता है, या य

  1. Java 9 में JavaFX का उपयोग करके JShell को प्रोग्रामेटिक रूप से लागू करें Java 9 में JavaFX का उपयोग करके JShell को प्रोग्रामेटिक रूप से लागू करें

    Java 9 ने jdk.jshell API पेश किया जो डेवलपर्स को अपने एप्लिकेशन में JShell कार्यक्षमता को एम्बेड करने की अनुमति देता है। यह लेख दिखाता है कि एक JavaFX एप्लिकेशन कैसे बनाया जाए जो JShell का उपयोग करके कोड स्निपेट्स का मूल्यांकन करता है और परिणाम प्रदर्शित करता है। आवश्यक निर्भरताएं Java 9+ (JSh