10 public static ArrayList<PrintWriter> noslist = new ArrayList<>();
11 public static ArrayList<User> Userdb = new ArrayList<User>();
12
13 public static void main(String[] args) throws Exception {14 System.out.println("Server signing On");
15 ServerSocket ss = new ServerSocket(9085);
16 MessageDispatcher md = new MessageDispatcher();
5import java.net.*;
6
7public class Client {
8 public static void main(String[] args) throws Exception { 9 System.out.println("Client Signing on");
10 try {
11 Socket soc = new Socket("127.0.0.1", 9085);
throws
clauses should not contain generic exception types such as Throwable
, Exception
, or RuntimeException
.
Instead, extend RuntimeException
and create more specific exception types which are relevant to your use case.
This issue will be reported for method and constructor declarations with throws
clauses that contain any of the following exception types:
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
Avoid using overly generic exception types:
public float getPercent() throws RuntimeException { ... }
Use a more specific exception type instead.
class CalculationException extends RuntimeException {
// ...
}
// ...
public float getPercent() throws CalculationException { ... }