Online Java Compiler By
JavaTpoint.com
import java.io.IOException; import java.net.MulticastSocket; public class JavaMulticastSocketsetTimeToLiveExample2 { public static void main(String[] args) throws IOException { MulticastSocket ms1 = new MulticastSocket(); //setTimeToLive() method ms1.setTimeToLive(40); System.out.println("Time to Live : " + ms1.getTimeToLive()); } }
Output