1.Understanding Object in Java Java is a successor to a number of languages including lisp, Simula67, CLU and SmallTalk. Java is similar to C and C++ because it syntax is borrowed from them , However a a deeper level it very different. - Objects in Java contain : STATE and OPERATIONS or methods. Programs interact with objects by invoking methods. Methods provide access to manipulate objects.
- Java programs consists of classes ? Classes : – To define collections of procedures – To define new data types
Example: To define collections of procedures ? Sort an array ? Search
Example of Search Class
2. Packages
Packages: a group of classes and interfaces Purposes: 1. Encapsulation mechanism Provide a way to share info within the package while preventing its use on the outside. How? By using visibility? public, private, etc?? 2. Naming purpose No name conflicts between classes and interfaces defined in different packages It is possible to have same names in other packages
3. Object and Variables All data are accessed by means of variables . Local variables such as those declared within methods, reside on the runtime stack; space is allocated for them when the method is called and deallocated when a method returns.
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
|