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.
import java.util.Random;
import java.math.BigInteger;
import java.net.HttpCookie;
import java.util.GregorianCalendar;
/**
* Demonstrates the creation of objects and their initialization
* with constructors.
*
* @author Anthony Polanco
*/
public class ConstructorDemo {
public static void main (String[]args){
Random rand = new Random();
BigInteger num = new BigInteger("123456789");
HttpCookie cookie = new HttpCookie("username","apolanco");
GregorianCalendar today = new GregorianCalendar();
GregorianCalendar bDay = new GregorianCalendar(1998, 12, 12);
}
}
/*
*I am cool
*@author Justin Dwyer
*/
public class ArithmeticDemo{
public static void main(String [] args) {
int x = 11;
int y = 5;
int v1 = x + y;
int v2 = x - y;
int v3 = x / y;
int v4 = x % y;
//sometimes i dream about cheese - valve 2004
/*
*this
*is
*a
*multiline
*comment
*/
System.out.println(v1);
System.out.println(v2);
System.out.println(v3);
System.out.println(v4);
}
}
/**
* Demonstrates the five arithmetic operators.
*
* @author Lauren Ferrara
*/
public class ArithmeticDemo {
public static void main(String []args){
int x = 13;
int y = 5;
// perform some arithmetic
int z1 = x + y;
int z2 = x - y;
int z3 = x * y;
int z4 = x / y;
int z5 = x % y;
// this is multiline
// comment
System.out.println(z1);
System.out.println(z2);
System.out.println(z3);
System.out.println(z4);
System.out.println(z5);
/* this is a multiline comment
it spans many lines */
System.out.println(x * 7 + y);
}
}
/**
* Demonstrates the five arithmetic operators.
*
* @author Brandon Bopp
*/
public class ArithmeticDemo {
public static void main(String []args) {
int x = 13;
int y = 5;
// perform some arithmetic
int z1 = x + y;
int z2 = x - y;
int z3 = x * y;
int z4 = x / y;
int z5 = x % y;
// This is a multiline comment that
// is really pretty useless but I have
// to say SOMEthing.
System.out.println(z1);
System.out.println(z2);
System.out.println(z3);
System.out.println(z4);
System.out.println(z5);
/* This is a multiline comment.
see... it spans many lines.
blah blah blah. */
System.out.println(x * 7 + y);
System.out.println(2.34 / 8.196);
System.out.println("abc" + "xyz");
System.out.println("The remainder is " + z5);
}
}
/**
* Demonstrates the "Big Five" of math
*
* @author Fenton Krupp
*/
public class MathDemo {
public static void main(String []args){
int x = 13;
int y = 5;
//to slam some simple math
int z1 = x + y;
int z2 = x - y;
int z3 = x * y;
int z4 = x / y;
int z5 = x % y;
/*
*
* WHAT A mAdmAN sT0p tH3 pre5ses
* It spans many lines.
* These stars make it look pretty.
*
*/
System.out.println("z1 is " + z1 + ".");
System.out.println("z2 is " + z2 + ".");
System.out.println("z3 is " + z3 + ".");
System.out.println("z4 is " + z4 + ".");
System.out.println("z5 is " + z5 + ".");
System.out.println(x * 7 + y);
}
}
/**
*Demonstrates arithmitic
*
* @author Nick Brown
*
*/
public class ArithDemo {
public static void main (String [] args) {
int x = 5;
int y = 2;
int z1 = x + y;
int z2 = x * y;
int z3 = x + y;
int z4 = x - y;
int z5 = x % y;
System.out.println(z1);
System.out.println(z2);
System.out.println(z3);
System.out.println(z4);
System.out.println(z5);
System.out.println(z4 * 45);
System.out.println("1");
System.out.println("3");
System.out.println("3");
System.out.println("7");
System.out.println("1337");
}
}