• 0
  • مالي خلق
  • أتهاوش
  • متضايق
  • مريض
  • مستانس
  • مستغرب
  • مشتط
  • أسولف
  • مغرم
  • معصب
  • منحرج
  • آكل
  • ابكي
  • ارقص
  • اصلي
  • استهبل
  • اضحك
  • اضحك  2
  • تعجبني
  • بضبطلك
  • رايق
  • زعلان
  • عبقري
  • نايم
  • طبيعي
  • كشخة
  • النتائج 1 إلى 3 من 3

    الموضوع: سؤال فى الجافا

    1. #1
      التسجيل
      11-09-2004
      الدولة
      ليبيا
      المشاركات
      56
      المواضيع
      13
      شكر / اعجاب مشاركة

      سؤال فى الجافا

      السلام عليكم .. كيف الحال
      انا عندى سؤال فى الجافا .. و اشاء الله فى حد يقدر ايجاوبنى
      سؤالى هوا .. فى بداية برنامج الmain فى الجافا نكتب
      Public static void
      لماذا نضيف public .. و ليست private . و ليست Protected
      و لماذا static ..
      و لماذا void .

      ياريت فى حد يقدر يجاوبنى .
      و شكراً.

    2. #2
      الصورة الرمزية shjoonal3in
      shjoonal3in غير متصل عضوة قديرة ومراقبة سابقة
      عبقري
       
      التسجيل
      23-12-2004
      الدولة
      AD
      المشاركات
      4,350
      المواضيع
      146
      شكر / اعجاب مشاركة

      رد: سؤال فى الجافا

      Public: يعني تقدر تستخدم هذه الميثود في خارج الكلاس أو الباكيج ... إذا كانت private or protected ما راح تقدر تستخدمها أبداً ...
      لأن ما راح يشوفها أي كلاس ثاني غير الكلاس اللي هي فيه
      static: هذه تعطيك القدرة إنك تستخدم الميثود من دون الحاجة لأوبجكت ... يعني لو محتاج تنادي أي ميثود -not static- من أي كلاس لازم يكون عندك أوبجكت من هالكلاس ... بينما إذا static ما يحتاج أوبجكت
      void: معناها ما راح ترجعلك قيمة ... string, int, etc
      إن شاء الله يكون واضح

      وإذا لأ هالفقرة توضح لك كل شي

      ---

      Public static void main (String args[])


      The public keyword is an access specifier, which allows the programmer to control the visibility of class members. When a class member is preceded by public, then that member may be accessed by code outside the class in which it is declared.In this case, main( ) must be declared as public, since it must be called by code outside of its class when the program is started. The keyword static allows main( ) to be called without having to instantiate a particular instance of the class. This is necessary since main( ) is called by the Java interpreter before any objects are made. The keyword void simply tells the compiler that main( ) does not return a value. As you will see, methods may also return values.
      As stated, main( ) is the method called when a Java application begins. Keep in mind that Java is case-sensitive. Thus, Main is different from main. It is important to understand that the Java compiler will compile classes that do not contain a main( ) method. But the Java interpreter has no way to run these classes. So, if you had typed Main instead of main, the compiler would still compile your program. However, the Java interpreter would report an error because it would be unable to find the main( ) method.
      Any information that you need to pass to a method is received by variables specified within the set of parentheses that follow the name of the method. These variables are called parameters. If there are no parameters required for a given method, you still need to include the empty parentheses. In main( ), there is only one parameter, albeit a complicated one. String args[ ] declares a parameter named args, which is an array of instances of the class String. Objects of type String store character strings. In this case, args receives any command-line arguments present when the program is executed.
      التعديل الأخير تم بواسطة shjoonal3in ; 09-11-2008 الساعة 02:23 AM

    3. #3
      التسجيل
      11-09-2004
      الدولة
      ليبيا
      المشاركات
      56
      المواضيع
      13
      شكر / اعجاب مشاركة

      رد: سؤال فى الجافا

      مشكور اخوى على الرد

    ضوابط المشاركة

    • لا تستطيع إضافة مواضيع جديدة
    • لا تستطيع الرد على المواضيع
    • لا تستطيع إرفاق ملفات
    • لا تستطيع تعديل مشاركاتك
    •