Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.*;
import javax.comm.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Enumeration ports = CommPortIdentifier.getPortIdentifiers();

        while (ports.hasMoreElements()) {
            CommPortIdentifier cpi = (CommPortIdentifier) ports.nextElement();
            System.out.println("Port " + cpi.getName());
        }
    }
}