FileDocCategorySizeDatePackage
Dec1.javaAPI DocExample911Thu Sep 27 23:11:34 BST 2001None

Dec1

public class Dec1 extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    int a; // a simple 4 byte integer
    long b; // an 8 byte integer
    float f1; // a real
    double f2; // double length real (default)
    char c; // a character
    String s; // a string of characters
    // Now let's do some assignment
    a = 478;
    b = 52;
    f1 = 836.201f;
    //If we try to assign to f1 without the f
    //suffix, it assumes double and won't assign
    // a double to a float
    f2 = -0.009672;
    c = 'B";
    s = "This is a test string";
    //Now for the output
    System.out.println(a);
    System.out.println("The double is " + b);
    System.out.print("The floats are " + f1);
    System.out.println(" and " + f2);
    System.out.println("Here is the character: " + c);
    System.out.println("And the string is: " + s);