Skip to content

Add strings to an array of strings inside for loop using java

I have a for loop and I want to add strings to a string array inside that loop. How can I achieve that? The output should look like this- Answer You can create the result array with a size that matches the registration array length, since you know you want to create one result for each registration entry. You…

Inherited objects outputs as null

I have Employee as my main class (used to get the name and call other methods). I created two inheritance class called FullTimeEmployee and PartTimeEmployee. The program is working except the getName() in my subclasses. The name the I input works in the main class but shows up as null in the subclasses. It al…

Server doesn’t forward message to all in the chat

i am trying to create a simple chat app using java sockets, the server is threaded, when a client connects its socket is added to an ArrayList, so that i can send to all in that list. the problem is when 3 clients are connected, the for loop that sends doesn’t work properly, for ex : client 0 sends to