Im trying to prompt my user to enter a port number when running the program and if they dont enter one then I need it to ask to enter a port number.
For example:
java myprogram 5324

I want to it to use that port number. But It wouldn't compile

     public static void main(String[] args) throws Exception
     {
         int Part = 1;
		 String port = args[0];
         DatagramSocket serverSocket = new DatagramSocket(port);
		 InetAddress myIp =InetAddress.getLocalHost();
         byte[] receiveData = new byte[1024];
         byte[] sendData = new byte[1024];
		 System.out.println("Using port: " + serverSocket.getLocalPort() );
		 System.out.println("IP: " + myIp.getHostAddress() );
         while(Part == 1)
         {
             DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
             serverSocket.receive(receivePacket);
             String Str= new String(receivePacket.getData());
             if(Str.contains("1"))


HERE ARE MY ERRORS
IntCountServer.java:19: error: no suitable constructor found for DatagramSocket(
String)
         DatagramSocket serverSocket = new DatagramSocket(port);
                                       ^
    constructor DatagramSocket.DatagramSocket(int,InetAddress) is not applicable
 
      (actual and formal argument lists differ in length)
    constructor DatagramSocket.DatagramSocket(int) is not applicable
      (actual argument String cannot be converted to int by method invocation co
nversion)
    constructor DatagramSocket.DatagramSocket(SocketAddress) is not applicable
      (actual argument String cannot be converted to SocketAddress by method inv
ocation conversion)
    constructor DatagramSocket.DatagramSocket(DatagramSocketImpl) is not applica
ble
      (actual argument String cannot be converted to DatagramSocketImpl by metho
d invocation conversion)
    constructor DatagramSocket.DatagramSocket() is not applicable
      (actual and formal argument lists differ in length)
IntCountServer.java:35: error: port is already defined in main(String[])
                 int port = receivePacket.getPort();
                     ^
IntCountServer.java:36: error: cannot find symbol
                 String capitalizedSentence = line.toUpperCase();
                                              ^
  symbol:   variable line
  location: class IntCountServer
3 errors