hai guys my question is regarding data protection.
conisder this program
// This class defines an integer stack that can hold 10 values.
class Stack {
int stck[] = new int[10];
int tos;
// Initialize top-of-stack
Stack() {
tos = -1;
}
// Push an item onto the stack
void push(int item) {
if(tos==9)
System.out.println("Stack is full.");
else
stck[++tos] = item;
}
// Pop an item from the stack
int pop() {
if(tos < 0) {
System.out.println("Stack underflow.");
return 0;
}
else
return stck[tos—];
}
}
in this program the tpo value and the stack size are public.
now if i give the compiles code i.e byte code to someone how can he change the value of top or size ..
how will the usage of aces specifier private prevent this harm from being done?