What does IDE stand for?
Integrated Development Environment
What file type is java source code stored in?
.java files
What happens during compiling?
.java file is compiled to produce a .class file. The .class file is then interpreted by the Java Virtual Machine
What is in a .class file?
a sort of generic machine language called Java Byte Code
What are the benefits of .class files?
very portable: anyone with a JVM can run it on any platform
secure: .class file is unreadable to humans
How do you run a java program you write on the command prompt?
javac <programName>.java -> compiles the code (to get the .class file)</programName>
java <programName> -> interprets the compiled code and runs your program</programName>
How do you write a string that must be broken up over multiple lines.
You cannot break a String literal over two or more lines. You must use the + operator
What are the primitive types?
integer types: int, long, short, byte
floating point types: double, float
others: char, boolean
When should you use and integer type other than int?
long should be used when you require numbers above 2 billion or below -2 billion. You must put an L at the end of a literal bigger than 2 billion
What type does 1.0 default to?
Double. To get a float, you must put an f at the end
What do you get from
‘a’ + true
‘a’ + 1
error
‘b’
how do you store a number as a string?
you must put it in quotes for literals or cast it with Integer.toString(variableName) or ““+variableName
What does the static keyword do?
Makes it into a global variable that is accessible anywhere in the class
What are the formatting codes?
%d - print a decimal integer here
%6d - use at least 6 characters to do that
%f - print a floating point value here
%6f - use at least 6 characters to do that
%6.2 - with exactly 2 of them after the decimal point
%s - print a String here
%n - print a newline character
How do you get a string input from the console?
What about an int?
Scanner in = new Scanner(System.in);
in.nextLine();
in.nextInt();
What are some escape characters?
\ - gives a backslash character
\n - gives a newline character
\t - gives a tab character
What are some String methods?
s.equals(“string”);
s.equalsIgnoreCase(“string”);
s.length();
s.charAt(1);