public
means the variable is available outside the class to anyone
Node
is the type of the variable
next
is it's name.
It means that if you have a sequence of Node instances in a list, you can traverse them all using the
next
variable of each:
Node current = GetHead();
while (current != null)
{
DoSomethingWithTheNode(current);
current = current.next;
}
But ... there are quite a few bad practices there.
Firstly, having public fields is a bad idea as it means external code can access it at any time - and your class doesn't know anything about it. That means that you can't change how your Node class works in any way without thinking long and hard about the possible effects on external code - any change you make could break the external app either directly by stopping it compiling, or indirectly by changing how it works.
public
shoudl be kept for properties, not applied to fields.
Secondly,
next
is a bad name - starting with a lowercase letter implies a local or internal variable, public items should start with an initial capital.
Thirdly, it's a very good idea to give an initial value to variables to prevent the compiler flagging up "uninitialized variable" errors:
public Node Next {get; set;} = null;