Check out example codes for "class as a data type in java". It will help you in understanding the concepts better.

Code Example 1

3
4
1 3 3 4
1 2 4 4
2
2 3
3 2
2
3 3
3 3

Code Example 2

Class Node {

Node next = null;
int data;

public Node(int d){ data = d; }

void append(int d)
    {
        blah blah blah
        ..............
    }
}

Learn ReactJs, React Native from akashmittal.com