Let's start writing the client. When the client starts running, it should request the server address and server port, connect to the specified address, receive a name request from the server, ask the user for his or her name, send the username to the server.
Chat (part 12)
You must be signed in to leave a comment
18 March 2022, 11:23
This one is pretty basic, just follow the directions and you're done. Surprised it wasn't marked as Easy.
23 May 2019, 16:47
Step 4: "Use an access modifier that will allow access to this field from subclasses, but will prevent calls from classes outside the package." Requirements: Step 3 " A protected Connection connection field must be created in the Client class." Protected modifier allows access to other packages who subclass this class. Access modifier should be default, "package private"?
24 May 2019, 06:10
4) Create a Connection connection field in the Client class. Use an access modifier that will allow access to this field from subclasses, but will prevent calls from classes outside the package. protected: Variables, methods, and constructors, which are declared protected in a superclass can be accessed only by the subclasses in other package or any class within the package of the protected members' class. default (package private): A variable or method declared without any access control modifier is available to any other class in the same package.
24 May 2019, 15:05
Thanks Roman. To me, "prevent calls from classes outside the package" doesn't excluded subclasses, since subclasses are still classes. So default fits that better. Something like "prevent calls from classes outside the package, except for subclasses" would be more clear to me that the goal is a protected modifier.