چند نکته در مورد Context و Static در جاوا

  • static is a keyword.
  • context will be created 1 time but object will be created many times.
  • context of the class is a memory location present inside RAM.
  • context is used to Load static members. the context of the class will be created only one per class.
  • JVM creates context of the class.
  • basically the members of the context are known as class variables because we can access them using the context name that is same as class name.
  • when you give .class file to jvm for execution, jvm loads all the static members and blocks to context of the class.
  • JVM first searches for the static block in the context of the class and once the block executions is finished, jvm searches for main method and executes the main method.
  • we can create many static block but it is not necessary.
  • we can call non static main method in static block. actually after that it is not main method and it can have any other name.
  • if we don't create static main method we can not have input parameter from command line
  • main method is necessary for C and C++ because they don't support static block but because of static block main method is not necessary in Java


نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد