Você está na página 1de 9

A sandbox refresher

Java's security model is focused on


protecting end-users from hostile
programs downloaded from untrusted
sources across a network. To accomplish
this goal, Java provides a customizable
"sandbox" in which Java programs run. A
Java program can do anything within the
boundaries of its sandbox, but it can't take
any action outside those boundaries. The
sandbox for untrusted Java applets, for
example, prohibits many activities,
including:
reading or writing to the local disk
making a network connection to any host,
except the host from which the applet
came
creating a new process
loading a new dynamic library and directly
calling a native method
CLASS LOADER Architecture
Types
• Primitive Types
• Reference Types
• Array Types
• Subtypes and Compatibility
• Signatures and Subsumption
shadowing
• http://www.perisic.com/shadow/
The following rules determine when a type t1 is a subtype of a type t2:
• Every type is a subtype of itself.
• If t1 is a subtype of t2, and t2 is a subtype of t3, then t1 is a subtype of t3.
• char is a subtype of int, long, float, and double.
• byte is a subtype of short, int, long, float, and double.
• short is a subtype of int, long, float, and double.
• int is a subtype of long, float, and double.
• long is a subtype of float and double.
• float is a subtype of double.
• If t1 and t2 are classes, then t1 is a subtype of t2 if t1 is a subclass of t2.
• If t1 and t2 are interfaces, then t1 is a subtype of t2 if t1 is a subinterface
of t2.
• If t1 is a class and t2 is an interface, then t1 is a subtype of t2 provided
that t1 (is a
• subclass of a class that) implements t2 or implements a subinterface of t2.
• Array type t1 [] is a subtype of array type t2 [] if reference type t1 is a
subtype of
• reference type t2.
• Any reference type t, including any array type, is also a subtype of
predefined class Object.
• No primitive type is a subtype of a reference type. No reference type is a
subtype of a primitive type.
Command Line argument
• A Java application can accept any number
of arguments from the command line
• When an application is launched, the
runtime system passes the command-line
arguments to the application's main
method via an array of Strings.
Operator Precedence
 () [] .
 ! ~ ++ -- + - (Data Type)
* / %
+ -
 << >> >>>
 < <= > >= instance
 == !=
 &^|
 &&
 ||
? :
 = += -= *= /= %= &= ^= |= <<= >>= >>>=
Not all combinations of instance and class variables
and methods are allowed:
• Instance methods can access instance variables
and instance methods directly.
• Instance methods can access class variables
and class methods directly.
• Class methods can access class variables and
class methods directly.
• Class methods cannot access instance variables
or instance methods directly—they must use an
object reference. Also, class methods cannot
use the this keyword as there is no instance for
this to refer

Você também pode gostar