EXAM 1 CS 2336 Java Basics

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/135

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:50 AM on 10/1/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

136 Terms

1
New cards

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.

2
New cards

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.

3
New cards

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).

4
New cards

Q: What is the JRE? A: Java Runtime Environment — the program for running Java programs (not the full development toolkit).

5
New cards

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.

6
New cards

Q: Are NetBeans and Eclipse different languages or dialects of Java? A: No. They are tools (IDEs), not different languages or dialects of Java.

7
New cards

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

8
New cards

Java EE (Enterprise Edition) — server-side (servlets, JSP, JSF)

9
New cards

Java ME (Micro Edition) — mobile devices

10
New cards

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.

11
New cards

Q: Where does a Java program begin execution? A: From the main method in a class — the entry point.

12
New cards

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.

13
New cards

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!"); } }

14
New cards

Q: What is a class in Java, and how should class names be written by convention?

15
New cards

A: Every Java program must have at least one class. By convention, class names start with an uppercase letter (e.g. Welcome).

16
New cards

Q: What is a method?

17
New cards

A: A construct that contains statements. A class may contain several methods; main is the entry-point method.

18
New cards

A: A sequence of characters enclosed in double quotation marks (e.g. "Welcome to Java!").

19
New cards

Q: What is the statement terminator in Java?

20
New cards

A: Every statement ends with a semicolon (;).

21
New cards

Q: What is a reserved word / keyword?

22
New cards

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.

23
New cards
24
New cards

25
New cards
26
New cards

Q: What are comments, and does the compiler execute them?

27
New cards

A: Comments document the program and are ignored by the compiler.

28
New cards
29
New cards

30
New cards
31
New cards

Q: What is a block in Java?

32
New cards

A: A pair of braces { } grouping components. Classes and methods each have a block. Blocks can be nested.

33
New cards
34
New cards

35
New cards
36
New cards

Q: What are the three comment styles Liang covers?

37
New cards

A: - Line comment: // — rest of the line ignored

38
New cards
  • Block/paragraph comment: /* … */ — can span lines
39
New cards
  • Javadoc comment: /** … */ — for classes/methods (must precede the header)
40
New cards
41
New cards

42
New cards
43
New cards

Q: What is the difference between System.out.print and System.out.println?

44
New cards

A: - println(...) — displays, then moves to the beginning of the next line

45
New cards
  • print(...) — same display, but does not advance to the next line
46
New cards
47
New cards

48
New cards
49
New cards

Q: What symbol is used for multiplication in Java?

50
New cards

A: * (asterisk), e.g. 2 * 3.

51
New cards
52
New cards

53
New cards
54
New cards

Q: Why must opening braces be matched, and why does case matter?

55
New cards

A: An opening brace must have a matching closing brace. Java is case sensitive: main ≠ Main, String ≠ string.

56
New cards
57
New cards

58
New cards
59
New cards

Q: List common beginner syntax traps from §1.10.4.

60
New cards

A: Missing ;, missing }, missing closing ", misspelling main as Main or String as string. Keywords must be lowercase.

61
New cards
62
New cards

63
New cards
64
New cards

Q: What file extensions are used for Java source and bytecode?

65
New cards

A: Source: .java. Bytecode: .class.

66
New cards
67
New cards

68
New cards
69
New cards

Q: What is the development cycle for a Java program?

70
New cards

A: Create/modify source → compile → execute. Fix compile errors and recompile; if runtime/logic problems, modify, recompile, run again.

71
New cards
72
New cards

73
New cards
74
New cards

Q: What is the file naming rule for a public class?

75
New cards

A: The source file must end with .java and have the exact same name as the public class. Example: public class Welcome → Welcome.java.

76
New cards
77
New cards

78
New cards
79
New cards

Q: What commands compile and run Welcome.java?

80
New cards

A: ```text

81
New cards

javac Welcome.java → produces Welcome.class (bytecode)

82
New cards

java Welcome → JVM runs the bytecode

83
New cards

Do not run java Welcome.class (looks for Welcome.class.class).

84
New cards
85
New cards

Q: What is bytecode? A: The low-level language produced by the compiler and stored in a .class file. It is architecture-neutral (portable).

86
New cards
87
New cards

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.

88
New cards
89
New cards

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.

90
New cards
91
New cards

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)

92
New cards
93
New cards

Bytecode verifier checks validity and security restrictions

94
New cards

Q: What causes NoClassDefFoundError? A: Trying to execute a class file that does not exist.

95
New cards
96
New cards

Q: What causes NoSuchMethodError related to main? A: The class has no main, or main is mistyped (e.g. Main).

97
New cards
98
New cards

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.

99
New cards
100
New cards

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.