কম্পিউটার টিউটোরিয়াল

জাভা ৯-এ JShell কী?

জেশেল (JShell) হলো জাভা ৯ ভার্সনে চালু একটি নতুন কনসেপ্ট। এটি জাভাকে REPL (Read-Eval-Print-Loop) ক্ষমতা প্রদান করে। জেশেল ব্যবহার করে আমরা কম্পাইল ছাড়া জাভা-ভিত্তিক লজিক এবং এক্সপ্রেশন টেস্ট করতে পারি। REPL একটি ইমিডিয়েট ফিডব্যাক লুপ হিসেবে কাজ করে এবং সে নির্দিষ্ট ল্যাঙ্গুয়েজে প্রোডাক্টিভিটিতে বড় প্রভাব ফেলে।

স্টেপ ১: কমান্ড প্রম্পট খুলুন এবং JShell টাইপ করুন।

Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\User>JShell
| Welcome to JShell -- Version 9.0.4
| For an introduction type: /help intro
jshell>

স্টেপ ২: JShell কমান্ড উইন্ডোতে /help টাইপ করুন (JShell কমান্ডগুলো দেখতে)।

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 (
| /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 comple
| information access, and automatic code generation
| context | the evaluation context options for /env /reload and /reset

স্টেপ ৩: JShell কমান্ড উইন্ডোতে /imports টাইপ করুন (JShell দ্বারা ইম্পোর্ট করা প্যাকেজগুলো দেখতে)।

jshell> /imports
| import java.io.*
| import java.math.*
| import java.net.*
| import java.nio.file.*
| import java.util.*
| import java.util.concurrent.*
| import java.util.function.*
| import java.util.prefs.*
| import java.util.regex.*
| import java.util.stream.*

স্টেপ ৪: JShell-এ ক্যালকুলেশন করুন (জেশেলে অ্যারিথমেটিক ক্যালকুলেশন ট্রাই করুন)

jshell> 3+5
$1 ==> 8
jshell> 8-4
$2 ==> 4
jshell> 2*6
$3 ==> 12
jshell> 9%3
$4 ==> 0
jshell> 8/2
$5 ==> 4

স্টেপ ৫: JShell থেকে বের হতে /exit টাইপ করুন।

jshell> /exit
| Goodbye
  1. জাভা ৯-এ জেশেলে স্ক্র্যাচ ভেরিয়েবল তৈরি করার পদ্ধতি

  2. জাভা ৯-এ জেশেলে এক্সসেপশন হ্যান্ডলিং

  3. জাভা ৯-এ জেশেলে এক্সটার্নাল লাইব্রেরি ইম্পোর্ট করার পদ্ধতি

  4. জাভাতে Stream