-
Notifications
You must be signed in to change notification settings - Fork 0
BasicTypes Code
staypufd edited this page Oct 7, 2014
·
1 revision
/** * */
/**
- @author javauser
*/ public class BasicTypes {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
boolean bird;
bird = true;
System.out.println("Bird's value is: " + bird);
bird = false;
System.out.println("Bird's value is: " + bird);
System.out.println("The boolean values");
System.out.println(Boolean.FALSE);
System.out.println(Boolean.TRUE);
System.out.println("----------------");
int count;
count = 10;
System.out.println(count);
System.out.println(count + 6);
// These are basically the same. The += is a shortcut syntax
count = count + 9;
System.out.println(count);
count += 9;
System.out.println(count);
System.out.println("Max and Min int values");
System.out.println(Integer.MAX_VALUE);
System.out.println(Integer.MIN_VALUE);
System.out.println(Integer.SIZE);
System.out.println("----------------");
System.out.println("Max and min long values");
System.out.println(Long.MAX_VALUE);
System.out.println(Long.MIN_VALUE);
System.out.println(Long.SIZE);
System.out.println("----------------");
System.out.println("Max and min float values");
// ????
System.out.println(Float.MIN_VALUE);
System.out.println(Float.MAX_VALUE);
System.out.println(Float.SIZE);
System.out.println("----------------");
System.out.println("Max and min double values");
// ????
System.out.println(Double.MIN_VALUE);
System.out.println(Double.MAX_VALUE);
System.out.println(Double.SIZE);
System.out.println("----------------");
System.out.println("char min and max values");
char minv = Character.MIN_VALUE;
char maxv = Character.MAX_VALUE;
System.out.println(Character.SIZE);
System.out.println(minv);
System.out.println(maxv);
System.out.println("\u00A9\u00B6\u2606");
System.out.println("string values");
System.out.println(String.valueOf(45.7));
char theCharacterA = 'A';
int addMeToChar = 97;
char lowerCaseA = 'a';
char unicodeChar = 'q';
char theValue = (char)(theCharacterA + addMeToChar);
System.out.println("The mystery char is: " + theValue);
/* char theCharAtValue = (char)theValue; System.out.println(theCharAtValue);*/ System.out.println(String.valueOf(theCharacterA));
int lowerCaseAsValue = lowerCaseA;
System.out.println(lowerCaseAsValue);
String myString = "";
System.out.println("----------------");
// Shorts
System.out.println("short min and max");
short q = 5;
short z = 5609;
System.out.println(Short.MIN_VALUE);
System.out.println(Short.MAX_VALUE);
System.out.println(Short.SIZE);
System.out.println("----------------");
// Bytes
System.out.println("byte min and max");
byte m = 5;
// byte n = 569;
System.out.println(Byte.MIN_VALUE);
System.out.println(Byte.MAX_VALUE);
System.out.println(Byte.SIZE);
}
}