/* * InetAddressDemo.java * * Created on 18 luty 2008, 09:24 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package sclient; // InetAddressDemo.java import java.net.*; class InetAddressDemo { public static void main (String [] args) throws UnknownHostException { String host = "localhost"; if (args.length == 1) host = args [0]; InetAddress ia = InetAddress.getByName (host); System.out.println ("Canonical Host Name = " + ia.getCanonicalHostName ()); System.out.println ("Host Address = " + ia.getHostAddress ()); System.out.println ("Host Name = " + ia.getHostName ()); System.out.println ("Is Loopback Address = " + ia.isLoopbackAddress ()); } }
/* * Tester.java * * Created on 18 luty 2008, 10:24 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package sclient; import java.text.*; import java.util.*; /** * * @author */ public class Tester { public static void main (String args[]) { Date date = new Date(); String rptDate; SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMM dd @ hh:mm"); rptDate = sdf.format(date); System.out.println(rptDate+"\n"); } }