MYSTERY ZILLION တွင် English သို့မဟုတ် Unicode ဖြင့်သာ အသုံးပြုခွင့်ရှိသည်။ ဇော်ဂျီ ၊ ဧရာ စသည်တို့ကို အသုံးပြုခွင့် မရှိ။ Unicode fonts များမှာ Mon3,Yunghkio, Myanamr3 စသည်များ အသုံးပြုနိုင်သည်။ Unicode Guide ကို ဒီမှာ Download ချပါ။ Zawgyi to Unicode Converter
Don't share ebook or software if nobody request. You can find free book websites on here. We are welcome for discussion or asking question instead.
Differences Between Parameters and Arguments(java)
java နဲ့ပတ်သက်ပီး မေးချင်လို့ပါ
static
argument နဲ့
parameter ကိုကွဲကွဲပြားပြား သိချင်ပါတယ်
အထူးသဖြင့် argument နဲ့ static အကြောင်း ရှင်းရှင်းလင်းလင်း သိချင်လို့ပါ
မှတ်ချက်များ
A **parameter **is a variable in a method definition. When a method is called, the arguments are the data you pass into the method's parameters. Parameter is variable in the declaration of function. **Argument **is the actual value of this variable that gets passed to function.
That can be clear. (This type of question can be seen on one key strike in Google)
Parameter ဆိုတာ method တစ်ခုမှာပါတဲ့ variable name ကိုဆိုလိုတာဖြစ်ပြီး Argument ဆိုတာ
ထို variable ထဲမှာရှိတဲ့ value ကိုဆိုလိုတာဖြစ်တယ်။
Eg.
void Foo(int x, int y); // x and y are parameters
Foo(1, 2); // 1 and 2 are arguments
static ဆိုတဲ့ keyword အကြောင်းလေး သိသလောက်ပြောပြပါရစေ။ static ဆိုတဲ့ keyword ကို အသုံးပြုတဲ့ နေရာအပေါ်မှာ လိုက်ပြီး အဓိပ္ပာယ်ကွာခြားပါတယ်။
၁။ variable ရဲ့ ရှေ့မှာ
variable ကြေငြာတဲ့ အခါမှာ static keyword နဲ့ကြေငြာရင် ၎င်း variable ဟာ Object (သို့မဟုတ်) instance က ပိုင်ဆိုင်တဲ့ variable မဟုတ်တော့ပဲ class က ပိုင်ဆိုင်တဲ့ variable ဖြစ်သွားပါတယ်။
၂။ method ရဲ့ရှေ့မှာ
method ရဲ့ရှေ့မှာကြေငြာရင် variable ရဲ့ရှေ့မှာ ကြေငြာတာနဲ့ အလားတူပါပဲ class က ပိုင်ဆိုင်တဲ့ method ဖြစ်သွားပါတယ်။
နည်းနည်းလောက်ရှင်းပြပါဦးမယ်။ class ကပိုင်ဆိုင်တော့ ဘာဖြစ်သလဲပေါ့။ class က ပိုင်ဆိုင်တဲ့ variable သို့မဟုတ် method ဆိုရင် ၎င်း class ရဲ့ instance (instance ဆိုတာ Class တစ်ခုကနေတည်ဆောက်ထားသော object ကို ဆိုလိုပါတယ်။ ဥပမာ
Foo f = new Foo();
) ဆောက်စရာမလိုပဲ Class ကနေတစ်ဆင့်တိုက်ရိုက်တန်းခေါ် ၊ တန်းသုံးလို့ရတယ်လို့ဆိုလိုတာပါ။ ဆိုတော့ static variable တွေဟာ class က ပိုင်ဆိုင်တာပါ။ instance တွေက မပိုင်ဆိုင်ပါဘူး။ အသုံးပြုခွင့် သာရပါတယ် ၊ ကိုယ်ပိုင် မပိုင်ဆိုင်ပါဘူး။ ဒါကြောင့် instance တစ်ခုကနေ static variable ရဲ့ တန်ဖိုးကို ပြောင်းလဲခဲ့ရင် ၎င်း variable ကို အသုံးပြုနေတဲ့ instance တိုင်းမှာ ပြောင်းလဲမှုရှိပါမယ်။ဘယ်လို variable တွေရှေ့မှာ static ကိုသုံးသလဲ ဆိုရင် static method တွေမှာ အသုံးပြုနိုင်တဲ့ class ရဲ့ variable ဟာ static ဖြစ်ရမယ်လို့ ကန့်သတ်ချက်ရှိတဲ့ အတွက် static ကြေငြာပေးရတဲ့ အခါမျိုးရှိပါတယ်။ နောက်ပြီး အထက်မှာဖော်ပြခဲ့သလို instance တိုင်းမှာ reflect ဖြစ်စေမယ့် variable ကို ထားချင်တဲ့ အခါမှာ static variable ကို သုံးပါတယ်။ အသုံးအများဆုံးပုံစံကတော့ constant variable ကြေငြာတဲ့အခါမှာ static ကိုသုံးပါတယ်။ constant variable ကို Java မှာကြေငြာချင်ရင် static final နဲ့ကြေငြာရပါတယ်။
ဘယ်လို method တွေရှေ့မှာ static ကိုသုံးသလဲဆိုရင် method တစ်ခုဟာ ၎င်းကို အသုံးပြုဖို့အတွက် instance ဆောက်စရာမလိုဘူးလို့ သတ်မှတ်ခံရတဲ့ method တွေ၊ သို့မဟုတ် Class တစ်ခုက ၎င်း class ရဲ့ instance ကို ဆောက်ခွင့်မပေးထားပဲ method တွေကိုသာအသုံးပြုစေလိုတဲ့အခါမှာ static keyword နဲ့တွဲဖက်ပြီး method ကိုကြေငြာလေ့ရှိပါတယ်။ အသုံးများတာကတော့ Utility class တွေ API class တွေမှာ ဖြစ်ပါတယ်။ ဥပမာ -
String.valueOf(....), Integer.parseInt(....), Arrays.binarySearch(a, key) etc;
၃။ class ရဲ့ရှေ့မှာ
class ရဲ့ရှေ့မှာ static keyword နဲ့ ကြေငြာတာကတော့ Inner class တွေမှာ တွေ့ရမှာဖြစ်ပါတယ်။ Inner class ရဲ့ရှေ့မှာ static ကပ်လိုက်ရင် ၎င်း inner class ဟာ (Nested Class) ဖြစ်သွားပါတယ်။ တစ်နည်း Parent class ကသာပိုင်ဆိုင်တဲ့ variable တစ်ခုနဲ့ အလားတူပါတယ်။
အကြမ်းဖျင်းပြောရရင်တော့ static keyword ကို class က ပိုင်ဆိုင်တဲ့အရာအဖြစ် သတ်မှတ်တဲ့အခါသုံးပါတယ်။
Parameter နဲ့ Argument ကတော့ ကို @99poison ပြောသလိုပါပဲ
Parameter = method တစ်ခုရဲ့ ( ) ကွင်းအတွင်း မှာကြေငြာတဲ့ local variable ဖြစ်ပါတယ်။
Argument = method တစ်ခုကို ခေါ်ယူအသုံးပြုဖို့အတွက် ထည့်ပေးရမယ့် သက်ဆိုင်ရာ တန်ဖိုးတွေ ဖြစ်ပါတယ်။
အကို deathwings ေြပာတ့ဲ အထဲမှာ class က ေန တိုက္၇ိုက္ ေခးါ သံုးလုိ့ ရတယ္္ ဆိုတာ ဘယလို ေခါ သံုးရတာကိုေျပာတာလဲခင္ ဗ်ာ
@Nainglynx Unicode နဲ့ရေးပေးပါခင်ဗျာ။ Class တစ်ခုအတွင်းထဲမှာ ရေးသားထားတဲ့ static မဟုတ်သော method တစ်ခုကို အသုံးပြုနိုင်ဖို့အတွက် ၎င်း class ရဲ့ instance (new keyword ဖြင့်ဆောက်ထားသော object) ရှိမှာသာ ခေါ်သုံးလို့ရနိုင်တာ ဖြစ်ပါတယ်။ အကယ်၍ method မှာ static keyword နဲ့ကြေငြာထားမယ်ဆိုရင်တော့ instance ဆောက်စရာမလိုပါဘူး။
ဥပမာ။ String class ထဲက
valueOf(..)
method ကိုခေါ်သုံးရန် String class မှ instance ဆောက်စရာမလိုပဲတန်းခေါ်သုံးနိုင်ပါတယ်။ အောက်ပါ code example ကိုကြည့်ပါ။