import java.util.*;
import java.lang.*;
import java.io.*;

// Suppose we want to start i at 1 and only allow it to grow 1 at a time
// We also want the programmer to be able to read but not set i
class A
{
    private int i;
    A()
    {
        i = 1;
    }
    public int get()
    {  
        return i;
    }
    public void increment()
    {
        i++;
    }
}

class B
{
    public int i;
}

// The main method must be in a class named "Main".
class Main
{
    public static void main(String[] args)
    {
        var a = new A();
        System.out.println(a.get());
        a.increment();
        System.out.println(a.get());
        System.out.println("no way to do something unanticipated with i");
        
        var b = new B();
        b.i = 1;
        System.out.println(b.i);
        b.i ++;
        System.out.println(b.i);
        b.i = -234324;
        System.out.println(b.i);
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: