import java.io.*;
import java.net.*;
public class pwundublfive{
public class Server{
private ServerSocket socket;
private int port;
public Server(int port) throws IOException{
socket = new ServerSocket(port);
socket.setSoTimeout(10000);
}
}
public static void main(String[] args){
int port = 1234;
Server obj = new Server(port); // <-- Error here
}
}
I know this question has been posted numerous times, and I understand most of the answers that well you can't call a member method on a class. But I'm instantiating a new object, which calls its constructor?? Thanks :)