StandardProtocolFamily class in Java

java.net.StandardProtocolFamily

Defines the standard families of communication protocols.

Declaration

public enum StandardProtocolFamily implements ProtocolFamily {

   
    INET,

   
    INET6
}


1. StandardProtocolFamily.INET

java.net.StandardProtocolFamily.INET

Internet Protocol Version 4 (IPv4)


2. StandardProtocolFamily.INET6

java.net.StandardProtocolFamily.INET6

Internet Protocol Version 6 (IPv6)

Approach

Java

package com.StandardProtocolFamily;

import java.net.StandardProtocolFamily;
import java.util.Arrays;

public class StandardProtocolFamilyConstants {
    public static void main(String[] args) {

        System.out.println(StandardProtocolFamily.INET);
        System.out.println(StandardProtocolFamily.INET6);

        System.out.println(StandardProtocolFamily.valueOf(StandardProtocolFamily.INET.toString()));

        System.out.println(Arrays.toString(StandardProtocolFamily.values()));
    }
}

Output

INET INET6 INET [INET, INET6]


No comments:

Post a Comment