Question: Noob question.

I have been programming at basic level for quite a while but I have trouble understanding class data type.

when we say `int a = 9;`
it means a is of data type int meaning it can contain only integers.

like wise for String, boolean, double, float etc.

But consider the following code:

```
Class Node {

Node next = null;
int data;

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

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

```

What does `Node next = null;` mean? I can understand the effort to create an object with

```
Node next = new Node();

```

and then try to manipulate the next object.

Answer: 
This code:

```
Node next = null;

```

declares a variable of type `Node`. As `Node` is a class, the value of `next` is always a reference - either to an object of type `Node` or a subclass, or the `null` reference which doesn't refer to any object at all... and in this case the variable starts off with a value of `null`.

It's really important to understand that the value of `next` is *never* a `Node` object itself... it's only ever a reference. So suppose we have:

```
Node next = new Node(10);
Node foo = next;

```

Here, `next` and `foo` are separate variables, each with independent values... but we've assigned the value of `next` as the initial value of `foo`, which means they both refer to the same object. So if we print out `foo.data`, it will be 10.

I like to think of variables as pieces of paper - and in the case of variables of reference types, what's written on the piece of paper is the address of a house, or the word "null". If two pieces of paper have the same address written on them, they refer to the same house - but the two pieces of paper themselves are independent. Changing the *value* of one variable (crossing out the current address and writing another one) doesn't change anything about the other variable... but changes to the *house itself* (e.g. painting a door red) are visible whichever piece of paper you use to get there.

Note that in your question, you've lumped `String` in with `int`, `double` and `boolean`... but whereas `int`, `double` and `boolean` are *primitive* types (where the value of a variable is simply the data itself - the number etc), `String` is a class, so it's a reference type. The value of a string variable isn't the text itself, but a reference.
The line

```
Node next = null;

```

means that you define a variable `next` which holds only references to objects of type (the class) `Node`. Additionally you initialize it with the `null` value which means `no object created yet`. 

Those variables actually hold references to objects and `null` is a special value valid only for objects which indicates that your variable is empty. This something like `next.append()` will fail with a nullpointer exception if `next` is still `null`.