Primitives Notebook
public class DefinePrimitives {
public static void main(String[] args) {
int anInt = 3;
double aDouble = 2.7;
boolean aBoolean = true;
// not primitives
String aString = "Primitives"; // wrapper class shortcut assignment
String aStringFormal = new String("Primitives are cool!");
System.out.println("anInt: " + anInt);
System.out.println("aDouble: " + aDouble);
System.out.println("aBoolean: " + aBoolean);
System.out.println("aString: " + aString);
System.out.println("aStringFormal: " + aStringFormal);
}
}
DefinePrimitives.main(null)
public class primitivesMath {
public static void main(String[] args){
int added = 0 + 3;
double subtracted = 3 - 0.3;
int divided = 39 / 3;
double multiplied = 0.5 * 2;
System.out.println("I should get a " + added + " on this assignment");
System.out.println("You get a " + subtracted + " if you do the bullet points");
System.out.println(divided + " is my favorite number");
System.out.println("I have " + multiplied + " dog");
}
}
primitivesMath.main(null)