Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas...

44
Universidad Nacional de Colombia Universidad Nacional de Colombia Facultad de Ingeniería Facultad de Ingeniería Departamento de Ingeniería de Departamento de Ingeniería de Sistemas Sistemas ertificación ertificación en en AVA AVA

Transcript of Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas...

Page 1: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Universidad Nacional de ColombiaUniversidad Nacional de Colombia

Facultad de IngenieríaFacultad de Ingeniería

Departamento de Ingeniería de Departamento de Ingeniería de SistemasSistemas

ertificación enertificación en

AVAAVA

Page 2: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

3. MODIFIERS3. MODIFIERS ObjectivesObjectives

ModifiersModifiers

Other ModifiersOther Modifiers

Page 3: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

ObjectivesObjectives

•Declare classes, inner classes, methods, instance variables, static variables and automatic (method local) variables, making appropriate use of all permitted modifiers (such as public, final, static, abstract, and so forth). State the significance of each of these modifiers both singly and in combination, and state the effect of packagerelationships on declared items qualified by these modifiers.

Page 4: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

ModifiersModifiers

• Specify that a particular feature is Specify that a particular feature is static, final or transientstatic, final or transient

feature:feature: a class, a method, or a variablea class, a method, or a variable• A group of modifiers (access modifiers) A group of modifiers (access modifiers)

dictate which classes are allowed to dictate which classes are allowed to use a featureuse a feature

• Other modifiers can be used in Other modifiers can be used in combination to describe the attributes combination to describe the attributes of a featureof a feature

Keywords that give the compiler information Keywords that give the compiler information about the nature of code, data or classes.about the nature of code, data or classes.

Page 5: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

class Parser{ ... }class Parser{ ... }public class public class

EightDimensionalComplex{ ... }EightDimensionalComplex{ ... }private int i;private int i;Graphics offScreenGC;Graphics offScreenGC;protected double getChiSquared() protected double getChiSquared()

{ ... }{ ... }private class Horse { ... }private class Horse { ... }

Some Legal declarationsSome Legal declarations

Page 6: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

public protected int x; // at most 1 public protected int x; // at most 1 //access modifier //access modifier

allowedallowedfriendly Button getBtn() {...} // friendly is friendly Button getBtn() {...} // friendly is

not a not a // modifier// modifier

Illegal declarationsIllegal declarations

Page 7: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

The The mostmost generous access modifier generous access modifier A public class, variable, or method may be A public class, variable, or method may be

used in any java program without restrictionused in any java program without restriction An applet is declared as a public class so An applet is declared as a public class so

that it may be instantiated by browsersthat it may be instantiated by browsers An application declares its An application declares its main()main() method to method to

be public so that main() may be invoked from be public so that main() may be invoked from any Java runtime environmentany Java runtime environment

publicpublic

Page 8: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

The The leastleast generous access modifier generous access modifier Top-level classes may not be declared Top-level classes may not be declared

privateprivate A private variable may only be used A private variable may only be used

by an instance of the class the class by an instance of the class the class that declares the variable or methodthat declares the variable or method

privateprivate

Page 9: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

1.1. class Complex{class Complex{2.2. private double real, imaginary;private double real, imaginary;

3.3. public Complex( double r, double i) {public Complex( double r, double i) {4.4. real=r; imaginary=i; }real=r; imaginary=i; }

5.5. public Complex add(Complex c) {public Complex add(Complex c) {6.6. return new Complex(real + c.real,return new Complex(real + c.real,7.7. imaginary+ c.imaginary);imaginary+ c.imaginary);8.8. }}9.9. }}10.10. 11.11. class Client {class Client {12.12. void useThem() {void useThem() {13.13. Complex c1 =new Complex(1, 2);Complex c1 =new Complex(1, 2);14.14. Complex c2 =new Complex(3, 4);Complex c2 =new Complex(3, 4);15.15. Complex c3 =c1.add(c2);Complex c3 =c1.add(c2);16.16. double d=c3.real; // Illegal!double d=c3.real; // Illegal!17.17. }}18.18. }}

Page 10: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Private data is hidden from every Private data is hidden from every object other than the one that owns the object other than the one that owns the datadata

If class Complex has a subclass called If class Complex has a subclass called SubComplex, then every instance of SubComplex, then every instance of SubComplex will inherit its own real SubComplex will inherit its own real and imaginary variables; an instance of and imaginary variables; an instance of a subclass is denied accessa subclass is denied access

Page 11: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

1.1. class Complex{class Complex{2.2. private double real, imaginary;private double real, imaginary;

3.3. public Complex add(Complex c) {public Complex add(Complex c) {4.4. return new Complex(real + return new Complex(real +

c.real, c.real, 1.1. imaginary + c.imaginary);imaginary + c.imaginary);

5.5. }}6.6. }}

7.7. class SubComplex extends Complex {class SubComplex extends Complex {8.8. SubComplex(double r, double i) {SubComplex(double r, double i) {9.9. real = r;real = r; // compiler error// compiler error10.10. }}11.11.}}

Page 12: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Is the name of the default access of Is the name of the default access of classes, variables and methodsclasses, variables and methods

A class’ data and methods may be A class’ data and methods may be friendly as the class itselffriendly as the class itself

A class’ friendly features are A class’ friendly features are accessible to any class in the same accessible to any class in the same

Friendly is not a java keywordFriendly is not a java keyword Java considers that all classes in the Java considers that all classes in the

directory actually make up a packagedirectory actually make up a package

friendlyfriendly

Page 13: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

packagepackage

class

Class

Class

ClassClass

Class

Class

Class

Class

Page 14: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

protectedprotected

Only variables, methods, and Only variables, methods, and inner classes may be inner classes may be declared protecteddeclared protected

protected features are even more accessible protected features are even more accessible than friendly featuresthan friendly features

A protected feature is available to all classes in A protected feature is available to all classes in the same package, just like a friendly featurethe same package, just like a friendly feature

A protected feature is available to all the A protected feature is available to all the subclasses of the class that owns the protected subclasses of the class that owns the protected featurefeature

This access is provided even to subclasses that This access is provided even to subclasses that reside in a different package from the class reside in a different package from the class that owns the protected featurethat owns the protected feature

Page 15: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

package sportinggoods;package sportinggoods;class Ski {class Ski {

void applywax() { ... }void applywax() { ... }}}

package sportinggoods;package sportinggoods;class DownhillSki extends Ski {class DownhillSki extends Ski {

void tuneup() {void tuneup() {applywax();applywax();// other tuneup functionality // other tuneup functionality

herehere}}

}}

Page 16: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

package adifferentpackage; // class Ski now package adifferentpackage; // class Ski now in a in a // different // different packagepackage

class Ski {class Ski {protected void applymax() { ... }protected void applymax() { ... }

}}

package sportinggoods;package sportinggoods;class DownhillSki extends Ski {class DownhillSki extends Ski {

void tuneup() {void tuneup() {applywax();applywax();// other tuneup functionality // other tuneup functionality

herehere}}

}}

Page 17: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Methods may not be overridden to be more privateMethods may not be overridden to be more private

Subclasses and Method Subclasses and Method privacyprivacy

A method with some particular access type A method with some particular access type may be overriden by a method with a different may be overriden by a method with a different access type, provided there is a path from the access type, provided there is a path from the original type to the new type.original type to the new type.

publicprotectedfriendlyprivate

Page 18: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Illegal access types for Illegal access types for subclassessubclasses

privateprotected friendlypublic

Page 19: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Java does not care about order of Java does not care about order of appearance of modifiers:appearance of modifiers:

public final public final same assame as final publicfinal publicprotected staticprotected static same assame as static static

protectedprotected

Other ModifiersOther Modifiers

Not every modifier can be applied to every Not every modifier can be applied to every kind of feature.kind of feature.

Page 20: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Error:Error: ““Can’t subclass final Can’t subclass final classes”classes”

class SubMath extends class SubMath extends java.lang.Mathjava.lang.Math

Applies to classes, methods, and variablesApplies to classes, methods, and variables Final features may not be changedFinal features may not be changed A final class may not be subclassedA final class may not be subclassed A final variable may not be modified once it A final variable may not be modified once it

has been assigned a valuehas been assigned a value If a final variable is a reference to an If a final variable is a reference to an

object, it is the reference that must stay object, it is the reference that must stay the same, not the objectthe same, not the object

finalfinal

Page 21: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

1.1. class Walrus {class Walrus {2.2. int weight;int weight;3.3. Walrus(int w) { weight = w; }Walrus(int w) { weight = w; }4.4. }}5.5. 6.6. class Tester {class Tester {7.7. final Walrus w1=new Walrus(1500);final Walrus w1=new Walrus(1500);8.8. void test() {void test() {9.9. w1=new walrus(1400); // Illegalw1=new walrus(1400); // Illegal10.10. w1.weight=1800; w1.weight=1800; // Legal // Legal11.11. }}12.12. }}

You You may notmay not change a final object change a final object referencereference

You You maymay change data owned by an object change data owned by an object that is referred to by a final object that is referred to by a final object reference variablereference variable

Page 22: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

1.1. class Mammal {class Mammal {2.2. final void getAround() { }final void getAround() { }3.3. }}

4.4. class Dolphin extends Mammal {class Dolphin extends Mammal {5.5. void getAround() { }void getAround() { }6.6. }}

A final method may not be overridenA final method may not be overriden

Compiler error:Compiler error:““Final methods can’t be Final methods can’t be

overriden”overriden”

Page 23: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Can be applied to classes and methodsCan be applied to classes and methods A class that is abstract may not be A class that is abstract may not be

instantiatedinstantiated Abstract classes defer implementation to Abstract classes defer implementation to

subclassessubclasses If a class contains one or more abstract If a class contains one or more abstract

methods the compiler insists that the class methods the compiler insists that the class must be declared abstractmust be declared abstract

abstractabstract

Page 24: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

abstract void abstract void travel()travel()

class Animalclass Animal

void void travel()travel()

class Birdclass Bird

void void travel()travel()

class class FishFish

void void travel()travel()

class class SnakeSnake

Page 25: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

The compiler insists that the class must be The compiler insists that the class must be declared abstract if any of the following is truedeclared abstract if any of the following is true

The class has one or more abstract methodsThe class has one or more abstract methods The class inherits one or more abstract The class inherits one or more abstract

methods for which it does not provide methods for which it does not provide implementationsimplementations

The class declares that it implements an The class declares that it implements an interface but does not provide implementation interface but does not provide implementation for every method of that interfacefor every method of that interface

In a way, abstract is the opposite of In a way, abstract is the opposite of final:final:

A final classA final class MAY NOTMAY NOT be subclassedbe subclassedAn abstract classAn abstract class MUSTMUST be subclassedbe subclassed

Page 26: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

class Ecstatic {class Ecstatic {static int x=0;static int x=0; Ecstatic() { x++; }Ecstatic() { x++; }

}}

Applies to variables, methods, and Applies to variables, methods, and even a strange kind of code that is even a strange kind of code that is not part of a methodnot part of a method

You can think of a static features as You can think of a static features as belonging to a class, rather than belonging to a class, rather than being associated with an individual being associated with an individual instance of the classinstance of the class

staticstatic

Page 27: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Bad formBad formEcstatic e1 = new Ecstatic();Ecstatic e1 = new Ecstatic();Ecstatic e2 = new Ecstatic();Ecstatic e2 = new Ecstatic();e1.x = 100;e1.x = 100;e2.x = 200;e2.x = 200;reallyImportantVariable=e1.x;reallyImportantVariable=e1.x;

1.1. Via a reference to any instance of Via a reference to any instance of the class: the class:

Two ways to reference a static Two ways to reference a static variablevariable

Page 28: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Ecstatic e1 = new Ecstatic();Ecstatic e1 = new Ecstatic();Ecstatic e2 = new Ecstatic();Ecstatic e2 = new Ecstatic();Ecstatic.x = 100; // why did I do Ecstatic.x = 100; // why did I do

this?this?Ecstatic.x = 200;Ecstatic.x = 200;reallyImportantVariable=Ecstatic.reallyImportantVariable=Ecstatic.

x;x;

2. 2. Via the class name:Via the class name:

Page 29: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

class SomeClass {class SomeClass {static int i=48;static int i=48;int j=1;int j=1;

public static void main(String args[]) {public static void main(String args[]) {i += 100;i += 100;j *= 5; // compiler errorj *= 5; // compiler error

}}}}

Static methods are not allowed to use the non-Static methods are not allowed to use the non-static features of their class.static features of their class.

Static methods are not concerned with Static methods are not concerned with individual instances of a class.individual instances of a class.

They may be invoked before even a single They may be invoked before even a single instance of the class is constructed.instance of the class is constructed.

Page 30: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

class Xyz {class Xyz {int w;int w;void bumpW() {void bumpW() {

w++;w++;}}

}}

Non-static methods have an implicit variable Non-static methods have an implicit variable named this, which is a reference to the named this, which is a reference to the object executing the methodobject executing the method

Abbreviation forAbbreviation for this.w++;this.w++;

Page 31: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

1.1. import java.awt.*;import java.awt.*;

2.2. public class MyFrame extends Frame {public class MyFrame extends Frame {3.3. Myframe() {Myframe() {4.4. setSize(300, 300);setSize(300, 300);5.5. }}6.6. 7.7. public static void main( Stringpublic static void main( String[]

args ) {args ) {8.8. MyFrame theFrame=new MyFrame theFrame=new

Myframe();Myframe();9.9. theFrame.setVisible(true);theFrame.setVisible(true);10.10. }}11.11.}}

If a static method needs to access a non-static variable or If a static method needs to access a non-static variable or call a non-static method, it must specify which instance call a non-static method, it must specify which instance of its class owns teh variable or executes the method of its class owns teh variable or executes the method have an implicit variable named this, which is a have an implicit variable named this, which is a reference to the object executing the methodreference to the object executing the method

Page 32: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

class Cattle {class Cattle {static void foo() { }static void foo() { }

}}

class Sheep extends class Sheep extends Cattle {Cattle {void foo() { }void foo() { }

}}

A static method may not be overrriden A static method may not be overrriden to be non-static (and vice-versa)to be non-static (and vice-versa)

Error:Error:

““Static methods can’t be Static methods can’t be overrriden”overrriden”

Page 33: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

A static method may only access the static data A static method may only access the static data of its class; it may not access non-static dataof its class; it may not access non-static data

A static method may only call the static methods A static method may only call the static methods of its class; it may not call non-static methodsof its class; it may not call non-static methods

A static method has no this referenceA static method has no this reference A static method may not be overriden to be non-A static method may not be overriden to be non-

staticstatic

Summary (static)Summary (static)

Page 34: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

It is legal for a class to contain static code It is legal for a class to contain static code that does not exist within a method bodythat does not exist within a method body

A class may have a block of initializer code A class may have a block of initializer code that is simply surrounded by curly braces that is simply surrounded by curly braces and labeled staticand labeled static

Static initializersStatic initializers

public class StaticDemo {public class StaticDemo {static int i=5;static int i=5;

static {static {System.out.println(“Static code: i= System.out.println(“Static code: i=

“+ i++ );“+ i++ );}}public static void main( String [] args ) {public static void main( String [] args ) {

System.out.println(“main: i= “+ i++ System.out.println(“main: i= “+ i++ ););}}

}}

Page 35: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

the code inside the curlies is executed exactly the code inside the curlies is executed exactly once at the time the class is loadedonce at the time the class is loaded

At class-load time, all static initialization and At class-load time, all static initialization and all free-floating static code are executed in all free-floating static code are executed in order of appearance within the class definitionorder of appearance within the class definition

Static initializer codeStatic initializer code

public class StaticDemo {public class StaticDemo {static int i=5;static int i=5;

static {static {System.out.println(“Static code: i= System.out.println(“Static code: i=

“+ i++ );“+ i++ );}}public static void main( String[] args ) {public static void main( String[] args ) {

System.out.println(“main: i= “+ i++ System.out.println(“main: i= “+ i++ ););}}

}}

Page 36: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Can refer only to methodsCan refer only to methods Indicates that the body of a method is to Indicates that the body of a method is to

be found elsewherebe found elsewhere In the case of abstact methods, the body In the case of abstact methods, the body

is in a subclassis in a subclass With native methods, the body lies entirely With native methods, the body lies entirely

outside the Java Virtual Machine (JVM), in a outside the Java Virtual Machine (JVM), in a librarylibrary

Native code is written in a non-java Native code is written in a non-java language, and compiled for a single target language, and compiled for a single target machine typemachine type

When a native method is invoked, the When a native method is invoked, the libarry that contains the native code ought libarry that contains the native code ought ot be loaded and available to the JVMot be loaded and available to the JVM

nativenative

Page 37: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

1.1. class NativeExample {class NativeExample {2.2. native void native void

doSomethingLocal(int i);doSomethingLocal(int i);3.3. static {static {4.4.

System.loadLibrary(“MyNativeLib”);System.loadLibrary(“MyNativeLib”);5.5. }}6.6. }}

1.1. nativeExample natex;nativeExample natex;2.2. natex=new NativeExample();natex=new NativeExample();3.3. natex.doSomethingLocal(5);natex.doSomethingLocal(5);

Page 38: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

1.1. nativeExample natex;nativeExample natex;2.2. natex=new NativeExample();natex=new NativeExample();3.3. natex.doSomethingLocal(5);natex.doSomethingLocal(5);

Callers of native methods do not have Callers of native methods do not have to know that the method is nativeto know that the method is native

The call is made the same way as if it The call is made the same way as if it were non-nativewere non-native

Page 39: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Can be applied only to variablesCan be applied only to variables A transient variable is not stored as part A transient variable is not stored as part

of its object´s persistent stateof its object´s persistent state

transienttransient

Page 40: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Many objects (specifically those that implement either Many objects (specifically those that implement either the the SerializableSerializable or or ExternalizableExternalizable interfaces) can interfaces) can have their state serialized and written to some have their state serialized and written to some destination outside the JVMdestination outside the JVM

This is done by passing the object to the This is done by passing the object to the WriteObject()WriteObject() method of the method of the ObjectOutputStreamObjectOutputStream class class

If the stream is chained to a If the stream is chained to a FileOutputStreamFileOutputStream, then , then the object’s state is written to a filethe object’s state is written to a file

If the stream is chained to a socket’s If the stream is chained to a socket’s OutputStreamOutputStream, , then the object’s state is written to the networkthen the object’s state is written to the network

In both cases the object can be reconstituted by In both cases the object can be reconstituted by reading it from anreading it from an ObjectInputStreamObjectInputStream

Page 41: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

1.1. class WealthyCustomer extends class WealthyCustomer extends Customer implements Serializable {Customer implements Serializable {

2.2. private float $wealth;private float $wealth;3.3. private String accessCode;private String accessCode;4.4. }}

Once an object is written to a destination Once an object is written to a destination outside JVM, none of Java’s elaborate outside JVM, none of Java’s elaborate security mechanism is in effectsecurity mechanism is in effect

If an instance of this class were to be written If an instance of this class were to be written to a file or to the Internet, somebody could to a file or to the Internet, somebody could snoop the access codesnoop the access code

Page 42: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

1.1. class WealthyCustomer extends class WealthyCustomer extends Customer implements Serializable {Customer implements Serializable {

2.2. private float $wealth;private float $wealth;3.3. private transient String private transient String

accessCode;accessCode;4.4. }}

Now the value of Now the value of accessCodeaccessCode will not be will not be written out during serializationwritten out during serialization

Page 43: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Control access to critical code in Control access to critical code in multithreaded programsmultithreaded programs

To be seen in chapter 7To be seen in chapter 7

synchronizedsynchronized

Page 44: Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Ingeniería de Sistemas ertificación en AVA.

Only variables may be volatileOnly variables may be volatile Such variables might be modified Such variables might be modified

asynchronously, so the compiler takes special asynchronously, so the compiler takes special precautions (multi-processor environments)precautions (multi-processor environments)

volatilevolatile