انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Java Run-time Environment

Share |
الكلية كلية تكنولوجيا المعلومات     القسم قسم شبكات المعلومات     المرحلة 3
أستاذ المادة مهدي عبادي مانع الموسوي       09/11/2018 16:51:10
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 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 [methods]
– 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?? where public can be excess by same package and from another package.
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 or attributes.
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.

Every variable has to be declared and indicates its type.
Primitive types? int, boolean, char. Eg?
Other object types? defined by others. Eg: String and array contains references to objects
Primitive types

Discuss example… int i = 6;


? Other object types(including arrays, String)

Contain references to objects
Created by the use of new operator
E.g.: int [ ] a = new int [3]; array type contain three integer elements

Space for a new array of int object will be allocated on the heap and a reference to the object will be stored in a [i.e. in a stack memory].

Local Variables :
Must be initialized when they are declared. Such as : int =6;
Declaration: indicating type of a variable.



Example:-


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم