Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

ConstructorDemo

import java.util.Random;
import java.math.BigInteger;
import java.net.HttpCookie;
import java.util.GregorianCalendar;


/**
 * Demo of objects and constructors 
 * 
 * @author Wil levonuk
 * 
 */
public class ConstructorDemo 
{ 
    
	public static void main(String[] args) 
	{
	    //A zero-argument constructor is called a default constructor
	    //whereas a parameterized constructor takes one or more arguments
	 Random rand = new Random(34); //Random() is a default constructor 
	 BigInteger num = new BigInteger("666666666666666666666666666666666666"); 
	 System.out.println(rand);
	 HttpCookie cookie = new HttpCookie("username", "Password");
	 GregorianCalendar today = new GregorianCalendar();
	 GregorianCalendar bDay = new GregorianCalendar(1999, 4, 7); //operands 
	 System.out.println(today);
	 System.out.println(bDay);
	 System.out.print("This is " + 1 + "," + 2);

	}
	
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.