1/135
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What is the Java language specification?
The technical definition of Java’s syntax and semantics — the strict rules the language must follow so the computer can understand a program.
Q: What is the Java API (Application Program Interface)? A: Also called the library. It is the set of predefined classes and interfaces used for developing Java programs.
Q: What is the JDK? A: Java Development Toolkit/Kit — the software set for compiling, running, and testing Java programs (typically invoked from the command line).
Q: What is the JRE? A: Java Runtime Environment — the program for running Java programs (not the full development toolkit).
Q: What is an IDE? A: Integrated Development Environment — a tool (e.g. NetBeans, Eclipse) that integrates editing, compiling, building, debugging, and help in one GUI.
Q: Are NetBeans and Eclipse different languages or dialects of Java? A: No. They are tools (IDEs), not different languages or dialects of Java.
Q: What are the three Java editions and what is each for? A: - Java SE (Standard Edition) — client-side/desktop apps; foundation for other Java tech; this course uses SE
Java EE (Enterprise Edition) — server-side (servlets, JSP, JSF)
Java ME (Micro Edition) — mobile devices
Q: How are Java SE version numbers related to JDK names? A: Oracle releases each SE version with a JDK. Example: Java SE 8 → JDK 1.8 / JDK 8 / Java 8.
Q: Where does a Java program begin execution? A: From the main method in a class — the entry point.
Q: What does Liang mean by “console,” console input, and console output? A: Console = text entry/display device (old term). Console input = keyboard. Console output = monitor.
Q: Write a minimal Welcome program that prints “Welcome to Java!” A: ```java public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } }
Q: What is a class in Java, and how should class names be written by convention?
A: Every Java program must have at least one class. By convention, class names start with an uppercase letter (e.g. Welcome).
Q: What is a method?
A: A construct that contains statements. A class may contain several methods; main is the entry-point method.
A: A sequence of characters enclosed in double quotation marks (e.g. "Welcome to Java!").
Q: What is the statement terminator in Java?
A: Every statement ends with a semicolon (;).
Q: What is a reserved word / keyword?
A: A word with a specific meaning to the compiler that cannot be used for other purposes (e.g. class, public, static, void). Keywords are lowercase.
Q: What are comments, and does the compiler execute them?
A: Comments document the program and are ignored by the compiler.
Q: What is a block in Java?
A: A pair of braces { } grouping components. Classes and methods each have a block. Blocks can be nested.
Q: What are the three comment styles Liang covers?
A: - Line comment: // — rest of the line ignored
/* … */ — can span lines/** … */ — for classes/methods (must precede the header)Q: What is the difference between System.out.print and System.out.println?
A: - println(...) — displays, then moves to the beginning of the next line
print(...) — same display, but does not advance to the next lineQ: What symbol is used for multiplication in Java?
A: * (asterisk), e.g. 2 * 3.
Q: Why must opening braces be matched, and why does case matter?
A: An opening brace must have a matching closing brace. Java is case sensitive: main ≠ Main, String ≠ string.
Q: List common beginner syntax traps from §1.10.4.
A: Missing ;, missing }, missing closing ", misspelling main as Main or String as string. Keywords must be lowercase.
Q: What file extensions are used for Java source and bytecode?
A: Source: .java. Bytecode: .class.
Q: What is the development cycle for a Java program?
A: Create/modify source → compile → execute. Fix compile errors and recompile; if runtime/logic problems, modify, recompile, run again.
Q: What is the file naming rule for a public class?
A: The source file must end with .java and have the exact same name as the public class. Example: public class Welcome → Welcome.java.
Q: What commands compile and run Welcome.java?
A: ```text
javac Welcome.java → produces Welcome.class (bytecode)
java Welcome → JVM runs the bytecode
Do not run java Welcome.class (looks for Welcome.class.class).
Q: What is bytecode? A: The low-level language produced by the compiler and stored in a .class file. It is architecture-neutral (portable).
Q: What is the JVM? A: Java Virtual Machine — a program (not a physical machine) that interprets bytecode into machine code one instruction at a time. Needed to run Java on a computer.
Q: Why is Java portable (“write once, run anywhere” idea)? A: The same bytecode can run on any platform that has a JVM. Your code may also use library code that the JVM executes along with it.
Q: What do the class loader and bytecode verifier do when a program runs? A: 1. Class loader loads bytecode into memory (and other classes dynamically as needed)
Bytecode verifier checks validity and security restrictions
Q: What causes NoClassDefFoundError? A: Trying to execute a class file that does not exist.
Q: What causes NoSuchMethodError related to main? A: The class has no main, or main is mistyped (e.g. Main).
Q: What does the compiler take as input and produce as output? A: Input: source (.java). Output: bytecode (.class). Compile with javac; run with java.
Q: Why do style and documentation matter if a one-line program can still compile? A: Good style/documentation make programs easy to read and help prevent errors. Compiling on one long line is still bad style.