Paul Clapham wrote:Your main problem is that none of that code will compile, so running it is pointless.
In the first version, you have several local variables declared, and they all have the same name. This isn't allowed, and when you compile the code the compiler will tell you so. Don't ignore what the compiler tells you.
In the second version your line which says "New Server (5000)" isn't valid because "New" followed by "Server" isn't grammatical. The other lines attempt to create a new object of type "server", but the first line doesn't. Remember that Java is a case-sensitive language so "New" and "new" are different, and likewise "Server" and "server" are different.
Anyway, I recommend getting your code to compile before you proceed. If you have trouble understanding the error messages from the compiler, then certainly ask us about those messages here.