What's the difference between a private variable in a Java class and a private variable in a C++ structure?
Java code for example see below : implementing an ADT table. c++ example see below : applying "hiding the implementation"
I looked online couldn't find any helpful source related to this particular topic
Java example:
class Table{
    private int size;
    private int num;//numbers of items are stored in the arrray
    private int[] array;
    public Table(int size, int[] array){
        this.size = size;
        this.array = new int[size];
    }
    public insert(int[] array, int newItem){
        if(num<size){
            //for loop for adding items into the array;
        }
        else if(num>=size){
            //increment the size and copy the original array to the new array
        }
    }
}
C++ example of implementation hiding:
struct B{
private:
    char j;
    float f;
public:
    int i;
    void func();
};
void::func(){
    i = 0;
    j = '0';
    f = 0.0;
};
int main(){
    B b;
    b.i = i; // legal
    b.j = '1'; // illegal
    b.f = 1.0; // illegal now
}
in c++ we cant change the private variable, is it because these b.j = '1'; b.f = 1.0; two lines are in the main() function thats why? in java we cant change the private variables in main() neither.
thank you!